hw3 - CS161 - Homework 3 Due: Thursday July 16, 5pm 1. (5...

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

View Full Document Right Arrow Icon
CS161 - Homework 3 Due: Thursday July 16, 5pm 1. (5 points) Of the sorting algorithms we’ve seen so far ( InsertionSort , MergeSort , Quicksort , BubbleSort and HeapSort ), which are amenable to “on-disk” sorting, where the data is too large to Ft in memory. Brie±y explain your answers. 2. (5 points) CLRS 10.1-6 (pg. 204) 3. (5 points) CLRS 6-1a (pg. 142). Note this is a comparison of the two heap building procedures discussed in class. 4. (10 points) Suppose that in addition to the child pointers, we also want to keep track of the total number of nodes in the subtree rooted at a node with a Feld denoted keys . (a) (5 points) Modify BSTInsert to correctly keep track of keys . Does this change the running time? (b) (5 points) Given the additional Feld, write pseudocode for a pro- cedure BSTKeyLessThan ( T, k ) that takes a tree T and a num- ber k and returns the number of keys in T that are less than k . What is the worst case running time of your procedure?
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 document was uploaded on 05/25/2011.

Page1 / 3

hw3 - CS161 - Homework 3 Due: Thursday July 16, 5pm 1. (5...

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