$20
Electronic submission:
You must submit a single .zip archive file of your files. Use a utility that produces .zip files (Windows: right click | Send to | compress, Mac: right click | compress), and include only source files (.cpp, .h) and text files if applicable (.txt).
Objectives
▪ To implement a recursive version of quick sort using an array
▪ To time the algorithm
Project setup
Create the project mp07.<FirstLast. Replace FirstLast with your name and do not include the < brackets. For instance, mp07.SocratisTornaritis.
Add the provided files to your project:
main.cpp, heap.hpp, state.hpp, state.cpp
The folder mp07.Firstlast containing just the source file(s) and text file(s), is the one that you must zip and upload. Do not upload any IDE specific files.
Refer to the appropriate "how to" tutorial notes available on the course website, for instructions on how to create a project and manage its files.
Problem description:
Implement the heap by following the comments in the heap.hpp file and the algorithms found in the notes.
Program requirements:
(1) Implement the template Heap class in heap.hpp
Use the notes for the Heap implementation.
As you write your programs from here on out, documentation will be desirable and an essential part of your code. Add the following section to each of your programs to identify relevant information to anyone reading your code. The sample below is what I used for Main.java, so make the appropriate changes to reflect your current/accurate information. This is just a sample, so feel free to add to it if you want, but do not remove anything.
/* File: <filename
* Name: <your name
* Revised: <date authored
* Course: CS240 - Introduction to Computing III
*
* Desc: <program description
*/
Original heap:
WY Wyoming Cheyenne 582658 97812 1890 44
VT Vermont Montpelier 626630 9616 1791 14
WV West Virginia Charleston 1852996 24230 1863 35
OR Oregon Salem 3930065 98379 1859 33
VA Virginia Richmond 8260405 42775 1788 10
WI Wisconsin Madison 5742713 65496 1848 30
NJ New Jersey Trenton 8899339 8723 1787 3
ND North Dakota Bismark 723393 53819 1889 39
OK Oklahoma Oklahoma City 3850568 69899 1907 46
SC South Carolina Columbia 4774839 32021 1788 8
UT Utah Salt Lake City 2900872 84897 1896 45
WA Washington Olympia 6971406 71298 1889 42
MO Missouri Jefferson City 6044171 69702 1821 24
MT Montana Helena 1015165 147039 1889 41
NH New Hampshire Concord 1323459 9348 1788 9
KY Kentucky Frankfort 4395295 40411 1792 15
NC North Carolina Raleigh 9848060 53819 1789 12
NV Nevada Carson City 2790136 110572 1864 36
OH Ohio Columbus 11570808 44825 1803 17
ME Maine Augusta 1328302 35384 1820 23
RI Rhode Island Providence 1051511 1545 1790 13
SD South Dakota Pierre 844877 77116 1889 40
TX Texas Austin 26448193 268597 1845 28
MS Mississippi Jackson 2991207 48432 1817 20
NM New Mexico Santa Fe 2085287 121590 1912 47
CO Colorado Denver 5029196 104094 1876 38
MN Minnesota St. Paul 5420380 86935 1858 32
CA California Sacramento 37253956 163696 1850 31
ID Idaho Boise 1567582 83570 1890 43
IA Iowa Des Moines 3090416 56273 1846 29
NE Nebraska Lincoln 1868516 77349 1867 37
AK Alaska Juneau 710231 663267 1959 49
GA Georgia Atlanta 9687653 59425 1788 4
CT Connecticut Hartford 3574097 5543 1788 5
MI Michigan Lansing 9895622 96713 1837 26
AZ Arizona Phoenix 6392017 113998 1912 48
KS Kansas Topeka 2893857 82278 1861 34
IN Indiana Indianapolis 6483802 36417 1816 19
NY New York Albany 19615127 54555 1788 11
AR Arkansas Little Rock 2915918 53179 1836 25
LA Louisiana Baton Rouge 4625470 51988 1812 18
FL Florida Tallahassee 18801310 65755 1845 27
PA Pennsylvania Harrisburg 12773801 46055 1787 2
DE Delaware Dover 897937 2489 1787 1
MD Maryland Annapolis 5928814 12406 1788 7
MA Massachusetts Boston 6692824 10554 1788 6
TN Tennessee Nashville 6495978 42144 1796 16
AL Alabama Montgomery 4779736 52419 1819 22
IL Illinois Springfield 12830632 57914 1818 21 HI Hawaii Honolulu 1360301 10931 1959 50
Sorted heap:
AK Alaska Juneau 710231 663267 1959 49
AL Alabama Montgomery 4779736 52419 1819 22
AR Arkansas Little Rock 2915918 53179 1836 25
AZ Arizona Phoenix 6392017 113998 1912 48
CA California Sacramento 37253956 163696 1850 31
CO Colorado Denver 5029196 104094 1876 38
CT Connecticut Hartford 3574097 5543 1788 5
DE Delaware Dover 897937 2489 1787 1
FL Florida Tallahassee 18801310 65755 1845 27
GA Georgia Atlanta 9687653 59425 1788 4
HI Hawaii Honolulu 1360301 10931 1959 50
IA Iowa Des Moines 3090416 56273 1846 29
ID Idaho Boise 1567582 83570 1890 43
IL Illinois Springfield 12830632 57914 1818 21
IN Indiana Indianapolis 6483802 36417 1816 19
KS Kansas Topeka 2893857 82278 1861 34
KY Kentucky Frankfort 4395295 40411 1792 15
LA Louisiana Baton Rouge 4625470 51988 1812 18
MA Massachusetts Boston 6692824 10554 1788 6
MD Maryland Annapolis 5928814 12406 1788 7
ME Maine Augusta 1328302 35384 1820 23
MI Michigan Lansing 9895622 96713 1837 26
MN Minnesota St. Paul 5420380 86935 1858 32
MO Missouri Jefferson City 6044171 69702 1821 24
MS Mississippi Jackson 2991207 48432 1817 20
MT Montana Helena 1015165 147039 1889 41
NC North Carolina Raleigh 9848060 53819 1789 12
ND North Dakota Bismark 723393 53819 1889 39
NE Nebraska Lincoln 1868516 77349 1867 37
NH New Hampshire Concord 1323459 9348 1788 9
NJ New Jersey Trenton 8899339 8723 1787 3
NM New Mexico Santa Fe 2085287 121590 1912 47
NV Nevada Carson City 2790136 110572 1864 36
NY New York Albany 19615127 54555 1788 11
OH Ohio Columbus 11570808 44825 1803 17
OK Oklahoma Oklahoma City 3850568 69899 1907 46
OR Oregon Salem 3930065 98379 1859 33
PA Pennsylvania Harrisburg 12773801 46055 1787 2
RI Rhode Island Providence 1051511 1545 1790 13
SC South Carolina Columbia 4774839 32021 1788 8
SD South Dakota Pierre 844877 77116 1889 40
TN Tennessee Nashville 6495978 42144 1796 16
Grading Rubric
Feature
Point s
Wrong files submitted, or late submission
-50
Program does not compile or run
-6
Coding style
- no comments, bad variable names, no code structure
-5
Heap class
: Heap(), ~Heap(), isEmpty()
: <<()
: toString()
: sort()
: rebuild()
: remove()
: insert()
50
:3
:2
:5
:10
:10
:10
:10