Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network

  Advanced Search  

Written 4 Page 1 CS 2420 Fall 2010

Summary: Written 4 Page 1
CS 2420 Fall 2010
Written 4 10 Points **Due at Classtime** Late assignments are NOT accepted
1. Go to csilm.usu.edu. Look at CS3/Priority Queue, activity 3 (Heap as a Priority Queue).
Using the slider bar, increase the speed. As you insert nodes into the heap, notice the two
forms of the heap. The physical form is an array that is shown at the bottom of the
screen. The logical form is the tree itself.
Now, suppose you need a new operation for the priority queue. We will call it
changeKey. The idea is this. You have a priority queue to give out scholarships based
on ACT. Someone retakes the ACT test and their score improves or gets worse. You
want to adjust the tree to accommodate this change. Since we can't search a priority
queue easily, we will suppose that finding the subscript location of the value that changed
is handled by someone else. Write changeKey(int newValueSubscript, int newValue).
2. For a heap as a max priority queue, which of the following are efficient to do? Explain
your answer:
a. find the largest
b. find the smallest
c. find a node with a particular value
d. Sort the array
3. For each of the nodes in the heaps below, indicate the null pointer length. Merge the two


Source: Allan, Vicki H. - Department of Computer Science, Utah State University


Collections: Computer Technologies and Information Sciences