as2b - CS/SE 2C03 THE DEADLINE HAS BEEN EXTENDED TO MARCH...

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

View Full Document Right Arrow Icon
1 CS/SE 2C03 THE DEADLINE HAS BEEN EXTENDED TO MARCH 1 ST (Tuesday), 2011, 10:00pm. Assignment #2. Due February 14, (Monday), 2011. There is a box outside ITB 101. Please put you assignment in an envelope with your name and student number. Some of the problems below are easy but labour consuming. The reason I am asking you to do them is to strengthen your intuition. This can only be done by some experience. 1. a. Sort the following numbers using the heap sort: 5, 11, 20, 8, 13, 10, 25, 7, 30, 12, 10, 40, 0, 3, 10, 21, 16, 74 Illustrate all the steps. This is easy however labour consuming exercise, but it will give a good idea how INSERT(k) and DELETEMIN work for the heap. b. Repeat (a) but with non-recursive Merge Sort. 2. A root of a directed acyclic graph (dag) is a vertex r such that every vertex of the dag can be reached by a directed path from r. Write a program (in pseudo-code) to determine whether a dag is rooted. Assume that the dag is represented using adjacency lists. Consider two cases:
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/22/2011 for the course CS 1112 taught by Professor Dr.d during the Fall '11 term at McMaster University.

Page1 / 3

as2b - CS/SE 2C03 THE DEADLINE HAS BEEN EXTENDED TO MARCH...

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

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