Question
An algorithm take 2 ms input size n = 100 How large a problem can be solved in 10 min if the running time is the following (assume low order terms are )? Theta (N) Theta (N log2 N) Theta (N3) (1+1=2 ) consider the following program segment How many times the inner kop body iterates ? what's the growth rate of the run time function of this segment How many times the inner kop body iterates ? what's the growth rate of the run time function of this segment (3+3+3+3=12) consider the array 1,-9,89,25,0,5,99,-4 Show the programs and the array after path when the following algorithm are performed on this array selection sort Bubble Sort Insertion sort Merge Sort
Explanation / Answer
4) (a) Given segment, three operations are carried out each time the k loop is executed . 1.The k loop runs for j times, 2. j loop runs for i times and 3. i loop runs N times Running time of this function is O(N3). (b) Here given segment code, two operations are carried out time the j loop is executed.The j loops runs for i times and i loop runs n times.therefore the running time of this function is O(N2). Note:Post remaining Questions on another post. Note:Post remaining Questions on another post.