{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

midterm1234 - Comp Sci 1MD3 Mid-Term I 2003 Dr Jacques...

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

View Full Document Right Arrow Icon
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.
Background image of page 1

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

View Full Document Right Arrow Icon
1. Precisely define “Algorithm”. Give one consequence of the definition. [3] 2. What “grouping” do the following algorithms belong to? [3] (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? [2] 4. Give an example (by name) of an algorithm in each of the following classes: Θ(lg n ), Θ( n ), Θ( n 2 ). [3] 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] 2
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.

{[ snackBarMessage ]}