Give a big-O estimate for the number of times k gets updated in the following loop: k:= 0 i:= n while i>0 k:= k + i i:= i/ 2 O(n) а. o(Vn) Ob. O(n/2) O c. O(log(n)) d.


Give a big-O estimate for the number of times k gets updated in the following loop:<br>k:= 0<br>i:= n<br>while i>0<br>k:= k + i<br>i:= i/ 2<br>O(n)<br>а.<br>o(Vn)<br>Ob.<br>O(n/2)<br>O c.<br>O(log(n))<br>d.<br>

Extracted text: Give a big-O estimate for the number of times k gets updated in the following loop: k:= 0 i:= n while i>0 k:= k + i i:= i/ 2 O(n) а. o(Vn) Ob. O(n/2) O c. O(log(n)) d.

Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here