Quiz 6 Worksheet - Object - Oriented Program II | CMSC 132, Quizzes of Computer Science

Material Type: Quiz; Class: OBJECT-ORIENTED PROG II; Subject: Computer Science; University: University of Maryland; Term: Spring 2006;

Typology: Quizzes

Pre 2010

Uploaded on 07/29/2009

koofers-user-1ew
koofers-user-1ew 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CMSC 132 Quiz 6 Worksheet
The next quiz of the course will be on Friday, Aug 4. The following list provides more information about
the quiz:
The quiz will be a written quiz (no computer).
Closed book, closed notes quiz.
Answers must be neat and legible. We recommend that you use pencil and eraser.
The following exercises cover the material to be included in this quiz. Solutions to these exercises will not
be provided, but you are welcome to discuss your solutions with TAs and instructors during office hours.
Exercises
1.
Quick-Check Exercises 6, 7, 8 from Page 457 of the class Textbook (Koffman/Wolfgang).
2.
Check the heap videos available at:
http://www.cs.umd.edu/class/spring2006/cmsc132/Movies/HeapPart1.mov
http://www.cs.umd.edu/class/spring2006/cmsc132/Movies/HeapPart2.mov
3.
The MaxHeap class represents a max-heap. In a max-heap every element has to have a greater
key value than either of its children. The class definition associated with the MaxHeap class is:
public class MaxHeap<E extends Comparable<E>> {
ArrayList<E> data = new ArrayList<E>();
}
Complete the implementation of the MaxHeap class, by providing the following methods:
a. insert – Inserts an element in the heap.
b. remove – Removes the largest element from the heap and returns that element.
c. size – Returns the size of the heap.

Partial preview of the text

Download Quiz 6 Worksheet - Object - Oriented Program II | CMSC 132 and more Quizzes Computer Science in PDF only on Docsity!

CMSC 132 Quiz 6 Worksheet

The next quiz of the course will be on Friday, Aug 4. The following list provides more information about the quiz:

  • The quiz will be a written quiz (no computer).
  • Closed book, closed notes quiz.
  • Answers must be neat and legible. We recommend that you use pencil and eraser.

The following exercises cover the material to be included in this quiz. Solutions to these exercises will not be provided, but you are welcome to discuss your solutions with TAs and instructors during office hours.

Exercises

1. Quick-Check Exercises 6, 7, 8 from Page 457 of the class Textbook (Koffman/Wolfgang).

2. Check the heap videos available at:

http://www.cs.umd.edu/class/spring2006/cmsc132/Movies/HeapPart1.mov http://www.cs.umd.edu/class/spring2006/cmsc132/Movies/HeapPart2.mov

3. The MaxHeap class represents a max-heap. In a max-heap every element has to have a greater

key value than either of its children. The class definition associated with the MaxHeap class is:

public class MaxHeap<E extends Comparable> { ArrayList data = new ArrayList();

Complete the implementation of the MaxHeap class, by providing the following methods:

a. insert – Inserts an element in the heap. b. remove – Removes the largest element from the heap and returns that element. c. size – Returns the size of the heap.