MidtermWithSolSu98 - EEL 4851 Midterm Tuesdays and...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
EEL 4851 Midterm Summer 1998 Tuesdays and Thursdays 8:30 to 10:20 NAME___ Solutions __________________ SS#_____________________________ 1. Short questions. For each question you must explain your answer. Write neatly. I can not give you credit if I can not read your answer. a. What is the best sorting algorithm to use if the elements to sort are very large and swapping them takes a relatively long time. Selection sort. It only swaps ) ( n O times. b. What is the best sorting algorithm to use if the elements to sort are already almost sorted. Insertion sort. Its best case is when the list is almost sorted and is ) ( n O . c. What is the best searching algorithm to use if the list of data is sorted. Binary search. It only takes ) (log n O time but requires the list to be sorted. d. Why do we use the big-O notation instead of the actual number of comparisons to analyze algorithms. The actual number of comparisons is more difficult to calculate then the big-O number of comparisons. Since we are really only interested in the growth we do not need the exact calculations.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
e. Why are we not concerned about the constants in the big-O notation. We are interested in the rate of growth of the function. Regardless of how large a constant, a function with a higher growth rate will eventually be larger than the function with the smaller
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

MidtermWithSolSu98 - EEL 4851 Midterm Tuesdays and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online