Show Bid Request
Visual C++ 6.0
Bid Request Id: 4998
|
|
|
Posted by: |
salapaw (6 ratings)
(Software buyer rating 9.83)
|
Posted: |
Nov 15, 2001 6:04:50 PM EDT
|
Bidding Closes: |
Nov 29, 2001 6:05:29 PM EDT
|
Viewed (by coders): |
158 times
|
|
|
|
Description:
Short Heap Property work.
Deliverables: Part A: create a class that can read a sentinel-terminated list of numbers from an input file stream, and can store them in a vector using the convention discussed in lecture: the first element of the vector is ignored, and the first element of the list is stored at vector index 1. Your class must be able to print the list, and to report whether the numbers in the list obey the "minimum first" heap property. For example <0,9,7,21,34,10,15> obeys the "minimum first" property, but <0,10,7,21,9,34,15> does not. Assume that the list of numbers you will be processing consists of non-negative entries, with a negative value used as the terminating sentinel (the sentinel is not a part of the list).
Notes: write a constructor for your class that accepts an object of type ifstream by reference. This way whenever your class does any processing on the input file stream, the changes to the stream will reflect in the client code, and your class can then be used in a loop construct to process an input file with several sentinel-terminated lists. Also, make sure that you do not reimplement or use a priority queue: your only task is to check whether a sequence of numbers in a list obeys the heap property, that is list(i) <= list(2i) and list(i) <= list(2i+1).
Part B: write the main(int argc, char *argv[]) routine that takes a file name as a parameter, and uses the class you wrote for Part A to report results of processing an input file with several sentinel-terminated lists. Here is an example of a valid input file and corresponding output:
Input file:
0 9 7 21 34 10 15 -3
0 10 7 21 9 34 15 -17
Program output:
<0,9,7,21,34,10,15> obeys the "minimum first" heap property.
<0,10,7,21,9,34,15> does not obey the "minimum first" heap property.
Special Conditions / Other:
would like to have code for both Part A and B with some comments. Stating which A and B is as well.
Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements.
We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation.
If you notice a violation, you can report it to: abuse@rentacoder.com.
|
|
Bidding/Comments:
|
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests. |
See all rejected bids (and all comments)
Name |
Bid Amount |
Date |
Coder Rating |
|
|
This bid was accepted by the buyer!
|
$5 (USD)
|
Nov 15, 2001 11:56:44 PM EDT
|
9.86
(Excellent)
|
|
|
I shall be able to do this for you. I have worked extensively with vectors and algorithms. |
|
|
|
|
|