Skip to content

Commit

Permalink
heap time complexities
Browse files Browse the repository at this point in the history
  • Loading branch information
Beej Jorgensen committed Jan 18, 2019
1 parent 80f2f9d commit 91b7471
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion Analysis_Answers.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ Add your answers to the questions below.
Python built-in functions, you can find their time complexities here:
https://wiki.python.org/moin/TimeComplexity )

2. Could you make your algorithm run in better time? If so, how?
Other hints, to save you some searching:

* Heap insert: `O(log n)`
* Heap delete: `O(log n)`
* Heap get max: `O(1)`

2. Could one make your algorithm run in better time? If so, how? If not, why
not?

3. What is the space complexity of your `heapsort` function? Recall that your
implementation should return a new array with the sorted data. (Also remember
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ your project manager to more thoroughly assess your work.
This Sprint Challenge is split into two separate parts that test your ability to
write and analyze algorithms.

### 1. Self-Study/Essay Questions
### 1. Self-Study/Essay Questions (20% of your score)

For this portion of the sprint challenge, you'll be answering questions posed in
the `Algorithms_Questions.md` document inside the `Self-Study` directory. Write
Expand All @@ -47,7 +47,7 @@ answer. This could net you some partial credit if your justification is sound
but the answer you put down turns out to not be correct. Add your answers to the
questions in the `Algorithms_Answers.md` file.

### 2. Implement Heapsort
### 2. Implement Heapsort (65% of your score)

Inside the `task1` directory you'll find the `heap.py` file with a working
implementation of the heap class--the heap is already written for you.
Expand All @@ -74,7 +74,7 @@ data.
Run `python test_heap.py` to run the tests for your `heapsort` function to
ensure that your implementation is correct.

### 3. Analyze some runtimes
### 3. Analyze some runtimes (15% of your score)

Open up the `Analysis_Answers.md` file. This is where you'll jot down your
answers for the runtimes of the functions you just implemented.
Expand Down

0 comments on commit 91b7471

Please sign in to comment.