Software-Engineering
October 26, 2023GATE 2011
October 26, 2023Algorithms
Question 16
|
(a) Consider the following algorithm. Assume procedure A and procedure B take O(1) and O(1/n) unit of time respectively. Derive the time complexity of the algorithm in O-notation.
algorithm what (n) begin if n = 1 then call A else begin what (n-1); call B(n) end end.
(b) Write a constant time algorithm to insert a node with data D just before the node with address p of a singly linked list.
Theory Explanation.
|
Correct Answer: A
Subscribe
Login
0 Comments