Question
What will be the time complexity of the following program code?

Answer

Let's calculate the processing time of the programming code.

Therefore, the time complexity is of the order O(1) Total: 71 operations => 71 units of processing time Therefore, the time complexity is of the order O(1).

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free

Similar questions

Write script to input a number. If the number is negative, then again input the number. Keep on doing so until the user enters a zero or a positive number. When the user enters a non-negative number, display the message "Thank you".
To input three numbers and find whether they form the three sides of a triangle.
What is the purpose of rollback()? Write the syntax as well.
How to Set the index?
Write the definition of a function Reverse(X) in Python, to display the elements in reverse order such that each displayed element is the twice of the original element (element * 2) of the List X in the following manner:

Example:

If List X contains 7 integers is as follows:

X[0] X[1] X[2] X[3] X[4] X[5] X[6]
4 8 7 5 6 2 10

After executing the function, the array content should be displayed as follows:

Write definition of a method ZeroEnding(SCORES) to add all those values in the list of SCORES, which are ending with zero (0) and display the sum.

For example,If the SCORES contain [200,456,300,100,234,678]The sum should be displayed as 600.

Write the output of the given python program :

Observe the following tables VIDEO and MEMBER carefully and write the name of the RDBMS operation out of

(i) SELECTION (ii) PROJECTION (iii) UNION (iv) CARTESIAN PRODUCT, which has been used to produce the output FINAL RESULT as shown below, Also, find the Degree and Cardinality of the final result.

Observe the table ‘Club’ given below:

Table: Club

Member_id Member_Name Address Age Fee
M001 Sumit New Delhi 20 2000
M002 Nisha Gurgaon 19 3500
M003 Niharika New Delhi 21 2100
M004 Sachin Faridabad 18 3500

(i) What is the cardinality and degree of the above given table?

(ii) If a new column contact_no has been added and three more members have joined the club then how these changes will affect the degree and cardinality of the above given table.

For a given list of values in descending order, write a method in python to search for a value with the help of Binary Search method. The method should return position of the value and should return –1 if the value not present in the list.