This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Comp Sci 1MD3 Mid-Term I 2003 Dr. Jacques Carette Name: Student No.: Duration : 50 minutes • This midterm contains 18 questions on 3 double-sided pages (including this one). • This midterm will be marked out of 50. There are 55 total marks available. • Answer the question in the space provided. • Do not separate the pages. • Make sure that you do not get stuck on one question; use your time wisely. 1. Precisely define “Algorithm”. Give one consequence of the definition.  2. What “grouping” do the following algorithms belong to?  (a) quicksort (b) shortest path in a graph (with positive weights) (c) multiplication of n matrices of uneven sizes 3. How is the problem of ambiguity of algorithm representation usually solved?  4. Give an example (by name) of an algorithm in each of the following classes: Θ(lg n ), Θ( n ), Θ( n 2 ).  5. This question concerns the following pseudo-code: z ← 0; x ← 1; while (x < 6) do (z ← z+x; x ← x+1) (a) convert the pseudo-code to a C code fragment which uses the same constructs. No need to declare your variables.  2 (b) convert the pseudo-code to a C code fragment that uses a...
View Full Document
This note was uploaded on 10/27/2009 for the course COMP SCI 1MD3 taught by Professor Various during the Winter '07 term at McMaster University.
- Winter '07