You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-19Lines changed: 7 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Sprint Challenge: Data Structures and Algorithms
1
+
# Sprint Challenge: Data Structures
2
2
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.
4
4
5
5
## Instructions
6
6
@@ -18,15 +18,14 @@ Commit your code regularly and meaningfully. This helps both you (in case you ev
18
18
19
19
## Description
20
20
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.
22
22
23
-
### Data Structures
23
+
### Minimum Viable Product
24
24
25
-
It is recommended that you allot about 1 and a half hours for this portion of the Sprint Challenge.
26
25
27
26
#### Task 1. Implement Depth-First or Breadth-First Traversal on the Binary Search Tree Class
28
27
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:
30
29
31
30
*`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.
32
31
@@ -48,21 +47,10 @@ Navigate into the `ex1` directory in the `data_structures` directory. Inside, yo
48
47
49
48
> 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.
50
49
51
-
#### Task 2. Implement Heapsort
52
50
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
54
52
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.
Copy file name to clipboardExpand all lines: data_structures/Data_Structures_Answers.md
-4Lines changed: 0 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,3 @@ Add your answers to the questions below.
7
7
3. What is the runtime complexity of your `breadth_first_for_each` method?
8
8
9
9
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?
0 commit comments