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

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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. [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 (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.

Page1 / 6

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

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