Explore our Solution Library

Number of Views - 1989 199

Do my CS 5633 Analysis of Algorithms Assignment

Question - CS 5633: Analysis of Algorithms Spring 2014Homework 1 Please turn in a hard copy at the beginning of class on 1/23/14 . 1. Loop Invariants (10 points) : Consider the code below with computes log nfor any n 0. function log(n ) k = n c = 0 while k >1do k = k/2 c = c+ 1 end while return c end function (a) State a loop invariant for the while loop that will allow you to prove t he correctness of the algorithm. (b) Use the loop invariant to prove the correctness of the algorith m. For this you need to prove by induction that the invariant holds for each iteratio n of the loop, and then use the loop invariant after the last iteration of the lo op to prove the correctness of the algorithm. (c) What is the runtime of the algorithm? 2. Evaluating R ...Read More

Solution Preview - No Preview Available. <b>Check Original File</b>

Found What You Need?

Scroll down to find more if you need to find our more features