Skip to content

Commit 16149f3

Browse files
ElissaElissa
authored andcommitted
Splitting DS to its own Sprint Challenge
1 parent 17d33c1 commit 16149f3

File tree

9 files changed

+7
-119
lines changed

9 files changed

+7
-119
lines changed

README.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Sprint Challenge: Data Structures and Algorithms
1+
# Sprint Challenge: Data Structures
22

3-
In this week's Sprint you explored and implemented some classic algorithmic approaches and used them to solve novel problems. You also implemented some classic and fundamental data structures and learned about how to go about evaluating their respective runtimes and performance. This Sprint Challenge aims to assess your comfort with these topics through exercises that build on the data structures you implemented and the algorithmic intuition you've started to build up.
3+
In this week's Sprint you implemented some classic and fundamental data structures and learned about how to go about evaluating their respective runtimes and performance. This Sprint Challenge aims to assess your comfort with these topics through exercises that build on the data structures you implemented and the algorithmic intuition you've started to build up.
44

55
## Instructions
66

@@ -18,15 +18,14 @@ Commit your code regularly and meaningfully. This helps both you (in case you ev
1818

1919
## Description
2020

21-
This Sprint Challenge is split into two separate parts: a data structures portion and an algorithms portion.
21+
This Sprint Challenge is split into two separate parts: writing an algorithm to search a data structure and analyzing the performance of that algorithm.
2222

23-
### Data Structures
23+
### Minimum Viable Product
2424

25-
It is recommended that you allot about 1 and a half hours for this portion of the Sprint Challenge.
2625

2726
#### Task 1. Implement Depth-First or Breadth-First Traversal on the Binary Search Tree Class
2827

29-
Navigate into the `ex1` directory in the `data_structures` directory. Inside, you'll see the `binary-search-tree.py` file with a complete implementation of the binary search tree class. Your first task is to implement either `depth_first_for_each` or `breadth_first_for_each` on the `BinarySearchTree` class:
28+
Navigate into the `search` directory in the `data_structures` directory. Inside, you'll see the `binary-search-tree.py` file with a complete implementation of the binary search tree class. Your first task is to implement either `depth_first_for_each` or `breadth_first_for_each` on the `BinarySearchTree` class:
3029

3130
* `depth_first_for_each(cb)` receives an anonymous function as a parameter. It should then execute the anonymous function on each node in the tree in [depth-first](https://en.wikipedia.org/wiki/Depth-first_search) order. Your task is to implement the logic to traverse the tree in depth-first in-order fashion (as opposed to pre-order or post-order). Note that the pseudocode showcased on the Wikipedia article traverses the tree in-order.
3231

@@ -48,21 +47,10 @@ Navigate into the `ex1` directory in the `data_structures` directory. Inside, yo
4847
4948
> Note that it is not your job to worry about what the callback function being passed in is doing. That is up to the user of your traversal method. All you care about when implementing the traversal method is to call the passed-in callback in either depth-first or breadth-first order, depending on which traversal method you're implementing.
5049
51-
#### Task 2. Implement Heapsort
5250

53-
Inside the `ex2` directory you'll find the `heap.py` file with a working implementation of the heap class. Your second task is to implement a sorting method called [heapsort](https://en.wikipedia.org/wiki/Heapsort) that uses the heap data structure in order to sort an array of numbers. Your `heapsort` function should return a new list containing all of the sorted data.
51+
#### Task 2. Analyze some runtimes
5452

55-
Run `python test_heap.py` to run the tests for your `heapsort` function to ensure that your implementation is correct.
56-
57-
#### Task 3. Analyze some runtimes
58-
59-
Open up the `Data_Structures_Answers.md` file. This is where you'll jot down your answers for the runtimes of the functions you just implemented. If you implemented depth-first traversal, just answer the questions pertaining to the depth-first traversal algorithm. If you implemented breadth-first traversal, just answer the questions pertaining to breadth-first traversal. Make sure you answer the heapsort questions as well!
60-
61-
### Algorithms
62-
63-
It is recommended that you allot about 1 and a half hours for this portion of the sprint challenge.
64-
65-
For the algorithms portion of the sprint challenge, you'll be answering questions posed in the `Algorithms_Questions.md` document inside the `algorithms` directory. Write down your answer and also write down a justification for _why_ you put down that 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.
53+
Open up the `Data_Structures_Answers.md` file. This is where you'll jot down your answers for the runtimes of the functions you just implemented. If you implemented depth-first traversal, just answer the questions pertaining to the depth-first traversal algorithm. If you implemented breadth-first traversal, just answer the questions pertaining to breadth-first traversal.
6654

6755
### Stretch Problems
6856

algorithms/Algorithms_Answers.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

algorithms/Algorithms_Questions.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

data_structures/Data_Structures_Answers.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,3 @@ Add your answers to the questions below.
77
3. What is the runtime complexity of your `breadth_first_for_each` method?
88

99
4. What is the space complexity of your `breadth_first_for_each` method?
10-
11-
5. What is the runtime complexity of your `heapsort` function?
12-
13-
6. What is the space complexity of the `heapsort` function? Recall that your implementation should return a new array with the sorted data. What would be the space complexity if your function instead altered the input array?

data_structures/ex2/heap.py

Lines changed: 0 additions & 43 deletions
This file was deleted.

data_structures/ex2/test_heap.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)