Here is class 12 computer science Unit 7 [Type B] solutions for Sumita Arora back exercise assignment. Below includes both textual and video solutions wherever required. View all the answers in assignment for chapter 7 and for all chapters here.Watch all tutorials for chapter 7.
Due to the while loop having upper bound input i.e. n
Due to the three nested while loop each having n and product of three loop i.e. n^3.
Due to the nesting of the doIt() and having 5n in product with n for the while loop.
O(n) = n^4
Due to the nested while loop having upper bound input i.e. n hence it gives n^2 in product with nested function doIt() having O(n) = n^2.
O(n) = n^3
Due to the while loop having upper bound input i.e. n and the nested function doIt() having O(n) = n^2. Hence O(n) =n*n^2
O(n) = n
As the while loop will execute for the n times because i is initialized with n in the starting.
O(n) = n*p*m
The all three nested loop will be get product with upper bound to provide the complexity.
O(n) = logn
As of the mid positioning property similar to binary search.
O(n) = 2n
The two concatenate for loop of each upper bound n will be added to result the complexity.
O(n) = n+n
O(n) = n^2
O(n) = n
The while loop will execute for the n times as if bound has at most limit is n.
(i) Insertion Sort
(ii) Binary Search
(iii) Linear Search
Binary sort will be a good option as of having O(logn) time complexity than the other mentioned options.
Clear Doubts with Computer TutorIn case you’re facing problems in understanding concepts, writing programs, solving questions, want to learn fun facts | tips | tricks or absolutely anything around computer science, feel free to join CTs learner-teacher community: students.computertutor.in
You cannot copy content of this page