# csi 06 - CSI2110A/B Data Structures and Algorithms Midterm...

This preview shows pages 1–4. Sign up to view the full content.

CSI2110A/B Data Structures and Algorithms Midterm Examination Length of Examination: 2 hours October 22 nd , 2006, 14:00 Professors: P. Flocchini, J. Lang Page 1 of 8 Family Name: Other Names: Student Number: Signature: Closed Book. Please answer in the space provided (in this questionnaire) . If you do not understand a question, clearly state an assumption and proceed. No calculators or other electronic devices are allowed. At the end of the exam, when time is up: Stop working and turn your exam upside down. Remain silent. Do not move or speak until all exams have been picked up, and a TA or a Professor gives the go-ahead to leave. 1

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

View Full Document
Page Marks of each page PAGE 3 out of 7 PAGE 4 out of 6 PAGE 5 out of 5 PAGE 6 out of 5 PAGE 7 out of 4 PAGE 8 out of 3 TOTAL out of 30 2
In all questions where a big-Oh characterization is asked, give the best possible one. Question 1 [2 points] The ADT Sequence contains, among others, the following methods: last() returns the last element of the list previous(p) : returns the position of the element that precedes the element at position p . equal(p, NIL) : check whether position p points to a null element Consider algorithm A in the following pseudo-code: Algorithm A(Sequence L) // Assume L has at least two elements p = L.last(); p1 = previous(p); p2 = previous(p1); while not equal(p2, NIL) do { p = p1; p1 = p2; p2 = previous(p2)

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## csi 06 - CSI2110A/B Data Structures and Algorithms Midterm...

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

View Full Document
Ask a homework question - tutors are online