Constructors and methods program, C/C++ Programming

To complete this assignment, edit the following constructors and methods:

1. public MaxPQ(Key[] keys) - change the following loop

for (int k = N/2; k >= 1; k--)

sink(k);

2. private void swim(int k)

3. private void sink(int k)

It may also help to write the following helper methods:

4. private int findParent(k) - returns the parent of element k

5. private int findLargestChild(k) - returns the child of k with the largest key.

Math 140 Project 2 Due Date is anytime on Nov 1, 2012  

Output for SIZE = 4:

Array values for the heap created with MaxPQ(Keys[] keys)

3, 1, 2, 0

Array values for the heap created with MaxPQ(int capacity)

3, 0, 1, 2

Output for SIZE = 12:

Array values for the heap created with MaxPQ(Keys[] keys)

11, 6, 9, 10, 4, 5, 1, 7, 8, 2, 0, 3

Array values for the heap created with MaxPQ(int capacity)

11, 5, 8, 10, 0, 3, 4, 1, 6, 7, 2, 9

Output for SIZE = 20:

Array values for the heap created with MaxPQ(Keys[] keys)

19, 18, 9, 12, 15, 17, 6, 7, 8, 2, 10, 11, 3, 13, 14, 4, 16, 0, 5, 1

Array values for the heap created with MaxPQ(int capacity)

19, 18, 8, 11, 13, 16, 17, 1, 6, 7, 2, 9, 10, 0, 5, 12, 3, 14, 15, 4

Posted Date: 3/30/2013 3:02:13 AM | Location : United States







Related Discussions:- Constructors and methods program, Assignment Help, Ask Question on Constructors and methods program, Get Answer, Expert's Help, Constructors and methods program Discussions

Write discussion on Constructors and methods program
Your posts are moderated
Related Questions
A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Is it legal for a member function to say delete this? A: As long as you're cautious, it's OK for an object to delete this. Here's how I define "cautious": You have to be a

.Develop a two dimensional interactive game with the following features: 1. Use OpenGL (any version you find convenient) 2. The game can either be two player or one player with the

PROGRAM TO FIND WHETHER A NUMBER IS ODD OR EVEN int main() { int number ; printf("Enter a whole number\n"); scanf("%d",&number); if(number % 2 == 0) printf("n

write a program in c/C++ using nested if statement for calculating the average marks and grades of 5 subjects

MAT LAB programming Project Description: Just for who are PROFESSIONAL IN MATLAB i have simulation and i would like to simulate the equation in ,and test the all simulatio

C++ Multiplayer Game Programming Project Project Description: We are seeking an experienced C++ Game Programmer to enhance clientside related aspects of MCS: Mars City Securi

1. The main program must be in a file called A4.cpp 2. The data must be read in from a data file.  The user must enter the filename.  A sample data file will be provided on Mood

Project Description: I want someone to create and install a keylogger on a chrome browser. This could be a relatively simple job, please have experience with this type of work.

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send