The complexity of Binary search algorithm is I. O(n) II. O(log n) II. O(n^2) IV. O(n log n) V. None of the above O IV ov O|I >


The complexity of Binary search algorithm is<br>I. O(n)<br>II. O(log n)<br>II. O(n^2)<br>IV. O(n log n)<br>V. None of the above<br>O IV<br>ov<br>O|I<br>><br>

Extracted text: The complexity of Binary search algorithm is I. O(n) II. O(log n) II. O(n^2) IV. O(n log n) V. None of the above O IV ov O|I >
What is the time complexity of the following algorithm power(n.x).? Assume that each operation takes a unit time.<br>LongPower(int n, int x) {<br>long ans;<br>if(n==0) return 1;<br>elsel<br>ans = Power (n/2, x) * Power (n/2, x);<br>if (n % 2 == 1) ans *= x;<br>return ans;<br>A: Ө (n)<br>B: Ө (ogn)<br>C: e (n logn)<br>D: e (n^2)<br>E: None of the above<br>O A<br>B<br>D<br>O E<br>C.<br>

Extracted text: What is the time complexity of the following algorithm power(n.x).? Assume that each operation takes a unit time. LongPower(int n, int x) { long ans; if(n==0) return 1; elsel ans = Power (n/2, x) * Power (n/2, x); if (n % 2 == 1) ans *= x; return ans; A: Ө (n) B: Ө (ogn) C: e (n logn) D: e (n^2) E: None of the above O A B D O E C.

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here