Question
Write the processing time of the below program code:

Write the programming code differently, calculate its time complexity.

Answer


Calculate the processing time:


Total: 7n/2+1 operations => 7n/2+1 units of processing time

Therefore, the time complexity is of the order O(n).

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

Based on the following python code, find out the expected correct output(s) from the options (i) to (iv)
tup=("Red","Blue","Green","Yellow")
for i in range(3):
print(tup[random.randrange(1,4,2)],end="#")
(i) Blue#Blue#Yellow#
(ii) Red#Green#Green#
(iii) Blue#Yellow#Green# (iv) Blue#Green#Yellow#
What kind of data gets stored in cookies and how is it useful? 
Observe the following table and answer the parts (i) and (ii) accordingly

Table: Product

Pno Name Qty PurchaseDate
101 Pen 102 12-12-2011
102 Pencil 201 21-02-2013
103 Eraser 90 09-08-2010
109 Sharpener 90 31-08-2012
113 Clips 900 12-12-2011

(a) Write the names of most appropriate columns, which can be considered as candidate keys.

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

Write the advantage and disadvantages of Twisted pair cable.
 Write a python script to read the numbers from the user until user presses zero and print sum , average and maximum number entered by the user.
Write SQL statements to do the following:

(a) Using the three separate words "We,""study,"and "MySQL,"produce the following output: "We study MySQL "

(b) Use the string "Internet is a boon "and extract the string "net ".

(c) Display the length of the string "Informatics Practices ".

(d) Display the position of "My "in "Enjoying MySQL ".

(e) Display the name of current month.

Write the python function delete() to delete the record In the student table according to the rollno passed as parameter.
Write two characteristics of Web 2.0.  [Delhi, AI 2016]

Find and write the output of the following Python code:

 WAP to input 10 numbers and then display their sum and average. Also display the largest and the smallest of the numbers entered.