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
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,13 +30,15 @@ This Sprint Challenge is split into three parts:
30
30
31
31
A ring buffer is a non-growable buffer with a fixed size. When the ring buffer is full and a new element is inserted, the oldest element in the ring buffer is overwritten with the newest element. This kind of data structure is very useful for use cases such as storing logs and history information, where you typically want to store information up until it reaches a certain age, after which you don't care about it anymore and don't mind seeing it overwritten by newer data.
32
32
33
-
Implement this behavior in the RingBuffer class. RingBuffer has two methods, `append` and `get`. The `append` method adds elements to the buffer. The `get` method returns all of the elements in the buffer ordered from oldest to newest. In other words, least-recently added elements first, then most-recently added elements.
33
+
Implement this behavior in the RingBuffer class. RingBuffer has two methods, `append` and `get`. The `append` method adds elements to the buffer. The `get` method returns all of the elements in the buffer in a list in their given order. It should not return any `None` values in the list even if they are present in the ring buffer.
34
34
35
35
For example:
36
36
37
37
```python
38
38
buffer = RingBuffer(3)
39
39
40
+
buffer.get() # should return []
41
+
40
42
buffer.append('a')
41
43
buffer.append('b')
42
44
buffer.append('c')
@@ -70,9 +72,7 @@ Also, include the runtime and space complexities of the original code and your o
70
72
71
73
### Stretch Problems
72
74
73
-
1. Implement the other tree traversal algorithm that you didn't implement on the `BinarySearchTree` class. Run the appropriate test file to test your implementation's correctness. Then go back to the `Data_Structures_Answers.md` file and answer the time and space complexity questions pertaining to the traveral method you just implemented.
74
-
75
-
2. Say your code from `names.py` is to run on an embedded computer with very limited RAM. Because of this, memory is extremely constrained and you are only allowed to store names in arrays (i.e. Python lists). How would you go about optimizing the code under these conditions? Try it out and compare your solution to the original runtime. (If this solution is less efficient than your original solution, include both and label the strech solution with a comment)
75
+
1. Say your code from `names.py` is to run on an embedded computer with very limited RAM. Because of this, memory is extremely constrained and you are only allowed to store names in arrays (i.e. Python lists). How would you go about optimizing the code under these conditions? Try it out and compare your solution to the original runtime. (If this solution is less efficient than your original solution, include both and label the strech solution with a comment)
76
76
77
77
78
78
### Rubric
@@ -92,8 +92,7 @@ Also, include the runtime and space complexities of the original code and your o
92
92
93
93
#### Stretch
94
94
95
-
- Both DFS and BFS pass tests: 2 points
96
-
-`names.py` is optimized with sub-quadratic runtime complexity and tightly constrained linear space complexity: 2 points
95
+
-`names.py` is optimized with sub-quadratic runtime complexity and tightly constrained linear space complexity: 4 points
0 commit comments