quizOnBasics - Algorithm unknown (int sorted Array A, int...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
A Quiz on some basics 1. Analyze the asymptotic time-complexity of the following algorithm- fragment. for i = n through 1 do for j = 1 through n do for k = 1 through i do begin sum = sum + k; print sum; end; for i = 1 through n do sum = sum + i; 2. What does the following algorithm do? Set up a recurrence equation for it’s time-complexity and solve the recurrence equation.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Algorithm unknown (int sorted Array A, int start, int end, int key) begin if start = = end && A[start] = = key then return start; else begin int mid = floor( (start + end)/2 ); if key < A[mid] then return unknown(A, start, mid, key) else return unknown(A, mid+1, end, key); end; end....
View Full Document

This note was uploaded on 02/10/2012 for the course CSE 5211 taught by Professor Dmitra during the Spring '12 term at FIT.

Ask a homework question - tutors are online