Sorting Algorithm #1:
|
Sorting Algorithm #1 cont'd:
|
Sorting Algorithm #2:
|
Sorting Algorithm #2 cont'd:
|
Sorting Algorithm #3:
|
Sorting Algorithm #3 cont'd:
|
Sorting Algorithm #4:
|
Sorting Algorithm #4 cont'd:
|
18
/ \
33 26
/ \ / \
60 46 52 44
/ \
88 75
Using the min-heap above, remove the minimum value and
restore the heap using the algorithm discussed in lecture. For your
answer, show how the resulting heap would be stored in an array.
45 24 30 58 82 64 12 36
45 | 24 30 58 82 64 12 36 45
45 24 | 30 58 82 64 12 36 45
/
24
45 24 30 | 58 82 64 12 36 45
/ \
24 30
58 45 30 24 | 82 64 12 36 58
/ \
45 30
/
24
Note: As always, you will be graded in part on your coding style. Your code should be easy to read, well organized, and concise. You should avoid duplicate code.
------ [] Guess: t -----t [] Guess: a -----t [a] (There are no a's.) Guess: e -e--et [a] Guess: n -e--et [a, n] Guess: s se--et [a, n] Guess: r se-ret [a, n] Guess: c secret [a, n]In our implementation of Hangman, we will allow the user to guess as many times as they like.
If we generate feedback for each of these possible answers, we get:
| possible word | feedback |
|---|---|
| what | --a- |
| pump | -u-- |
| pull | -ull |
| lute | lu__ |
| bump | -u-- |
| that | --a- |
| junk | -u-- |
| lump | lu-- |
| from | ---- |
| jump | -u-- |
| will | --ll |
| Key | Value |
|---|---|
| -ull | 1 |
| -u-- | 4 |
| lu-- | 2 |
| ---- | 1 |
| --a- | 2 |
| --ll | 1 |
Write comments to document all of the public features. Include documentation for all the parameters and return value or changes to the state of the instance of the class. Add additional comments in your methods to explain your code where necessary. Use appropriate variable names for self-documentation and indent properly.