Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
1b32a44
insertion sort
Oct 1, 2020
f76b8e8
Merge pull request #1 from codebasics/insertion-sort-exercise
dhavalsays Oct 1, 2020
91fbf1e
Update insertion_sort_exercise.md
dhavalsays Oct 1, 2020
e8bb32e
Update insertion_sort_exercise.md
dhavalsays Oct 1, 2020
494c70f
added - Merge Sort Exercises
groverkds Oct 10, 2020
b377c4e
Merge pull request #4 from codebasics/merge-sort-exercise
groverkds Oct 10, 2020
6cd4c11
merge sort
dhavalsays Oct 19, 2020
845af5f
merge sort
dhavalsays Oct 19, 2020
c979dab
Shell Sort Exercise
udistructor Oct 22, 2020
86d7af2
fix error in doubly linked list
Oct 24, 2020
7c6144e
Removed extra files
udistructor Oct 25, 2020
aa41e65
Changed to snake_case
udistructor Oct 25, 2020
313fb28
Merge pull request #6 from udistructor/shell-sort-exercise
groverkds Oct 25, 2020
4abac94
shell sort
Oct 29, 2020
268310a
Selection Sort Exercise
udistructor Oct 30, 2020
4cbddc3
Minor modification in MD
udistructor Oct 30, 2020
4adc6d9
Fixed CamelCase to snake_case
udistructor Nov 2, 2020
a918f5f
Changed multilevel_sort Function to Generalized
udistructor Nov 2, 2020
1ebe3de
Removed Excessive PrintStatements
udistructor Nov 2, 2020
ea30df3
Generalized Sort Function
udistructor Nov 2, 2020
ae2863e
removed extra data
udistructor Nov 2, 2020
701666e
removed selection sort
udistructor Nov 2, 2020
12fe94b
Updated .md to describe the generalized problem
udistructor Nov 2, 2020
eb5c053
Merge pull request #7 from udistructor/selection-sort-exercise
groverkds Nov 2, 2020
3034b38
selection sort
Nov 25, 2020
64ea23c
Create dfs.py
beladiyadarshan Dec 7, 2020
dd12f8b
Create breadth_first_search.py
nikhilailani Dec 7, 2020
44b16f5
Update dfs.py
beladiyadarshan Dec 7, 2020
5bf76d5
Add files via upload
beladiyadarshan Dec 7, 2020
87e7baa
Create breadth_first_search_exercise.md
nikhilailani Dec 7, 2020
0dc70eb
Delete breadth_first_search.py
nikhilailani Dec 7, 2020
50db494
Delete breadth_first_search_exercise.md
nikhilailani Dec 7, 2020
8eafbd8
Create 9_breadth_first_search
nikhilailani Dec 7, 2020
9a0d3b4
Delete 9_breadth_first_search
nikhilailani Dec 7, 2020
1282827
Create bfs.py
nikhilailani Dec 7, 2020
3cc8866
Delete bfs.py
nikhilailani Dec 7, 2020
dee5947
Create bfs.py
nikhilailani Dec 7, 2020
ca1904f
Update bfs.py
nikhilailani Dec 7, 2020
cf7917f
Update dfs.py
beladiyadarshan Dec 7, 2020
f5c4289
Update Dfs_exercise.py
beladiyadarshan Dec 7, 2020
39df8b7
Create bfs_exercise.md
nikhilailani Dec 7, 2020
5f1c5f8
Update Dfs_Exerscise.md
beladiyadarshan Dec 7, 2020
8adbded
Create bfs_exercise_solution.py
nikhilailani Dec 7, 2020
7d58e11
Add files via upload
nikhilailani Dec 7, 2020
fef07b8
Update bfs_exercise.md
nikhilailani Dec 7, 2020
7d9cac4
Update bfs_exercise.md
nikhilailani Dec 7, 2020
e381bc8
Update Dfs_Exerscise.md
beladiyadarshan Dec 23, 2020
d6acab4
Update Dfs_exercise.py
beladiyadarshan Dec 23, 2020
23a6cc9
flake 8 convention followed
Dec 23, 2020
c199807
Modified md file
Dec 23, 2020
be64384
Create 9_BreadthFirstSearch module
nikhilailani Dec 23, 2020
4bf2c68
Rename Dfs_exercise.py to dfs_exercise.py
beladiyadarshan Dec 24, 2020
7dbdb25
Update and rename Dfs_Exerscise.md to dfs_exerscise.md
beladiyadarshan Dec 24, 2020
557eceb
corrected md file
Dec 24, 2020
f9284e0
Merge branch 'master' of https://github.com/beladiyadarshan/data-stru…
Dec 24, 2020
5e8bef6
BLD: added vscode/settings.json to gitignore
groverkds Dec 24, 2020
a1b46fb
Delete settings.json
groverkds Dec 24, 2020
70c126e
Delete settings.json
groverkds Dec 24, 2020
074c6ca
Update dfs_exercise.py
groverkds Dec 24, 2020
57f9f13
Update dfs_exerscise.md
groverkds Dec 24, 2020
1d7c308
Update dfs_exercise.py
groverkds Dec 24, 2020
e95a2b2
Merge pull request #8 from beladiyadarshan/master
groverkds Dec 24, 2020
699382b
Update bfs_exercise_solution.py
nikhilailani Dec 24, 2020
018f909
Update bfs_exercise_solution.py
nikhilailani Dec 24, 2020
8d9b988
Update bfs_exercise_solution.py
nikhilailani Dec 24, 2020
080306a
Update bfs_exercise.md
nikhilailani Dec 24, 2020
24c469c
Update bfs_exercise.md
groverkds Dec 24, 2020
c95f88c
Update bfs_exercise_solution.py
groverkds Dec 24, 2020
9e93155
Update bfs_exercise.md
groverkds Dec 24, 2020
6388874
Merge pull request #9 from nikhilailani/master
groverkds Dec 24, 2020
cdf5bbc
CLN: renamed the folder to follow the directory convention
groverkds Dec 24, 2020
be9fe69
updated links which were not working
groverkds Jan 26, 2021
4d8a294
updated not working links
groverkds Jan 26, 2021
3174849
recursion
Feb 10, 2021
f167a92
Merge branch 'master' of https://github.com/codebasics/data-structure…
Feb 10, 2021
fd97ca9
range updated to get odd numbers between 1 and max number
Aravinth-T Jul 8, 2021
6b8a495
Merge pull request #38 from Aravinth-T/master
dhavalsays Jul 8, 2021
7d353b8
Update bubble_sort_exercise.md
dhavalsays Nov 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updated links which were not working
  • Loading branch information
groverkds committed Jan 26, 2021
commit be9fe697fe46e4be29f94ca3b7d19be0b890d905
2 changes: 1 addition & 1 deletion algorithms/1_BinarySearch/binary_search_exercise.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
```
This should return 5,6,7 as indices containing number 15 in the array
[Solution](https://github.com/codebasics/py/blob/master/Algorithms/1_BinarySearch/binary_search_exercise_solution.py)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/algorithms/1_BinarySearch/binary_search_exercise_solution.py)
4 changes: 2 additions & 2 deletions algorithms/2_BubbleSort/bubble_sort_exercise.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Bubble Sort Exercise

Modify [bubble_sort function](https://github.com/codebasics/py/blob/master/Algorithms/2_BubbleSort/bubble_sort.py) such that it can sort following list of transactions happening in an electronic store,
Modify [bubble_sort function](https://github.com/codebasics/data-structures-algorithms-python/blob/master/algorithms/2_BubbleSort/bubble_sort.py) such that it can sort following list of transactions happening in an electronic store,
```
elements = [
{ 'name': 'mona', 'transaction_amount': 1000, 'device': 'iphone-10'},
Expand Down Expand Up @@ -36,5 +36,5 @@ elements = [
]
```

[Solution](https://github.com/codebasics/py/blob/master/Algorithms/2_BubbleSort/bubble_sort_exercise_solution.py)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/algorithmsAlgorithms/2_BubbleSort/bubble_sort_exercise_solution.py)

2 changes: 1 addition & 1 deletion algorithms/3_QuickSort/quick_sort_exercise.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Implement quick sort using lumoto partition scheme. This partition scheme is explained in the video tutorial, you need to write python code to implement it.
Check the pseudo code here: https://en.wikipedia.org/wiki/Quicksort Check the section Lomuto partition scheme

[Solution](https://github.com/codebasics/py/blob/master/Algorithms/3_QuickSort/quick_sort_exercise_soluiton_lomuto.py)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/algorithms/3_QuickSort/quick_sort_exercise_soluiton_lomuto.py)



6 changes: 3 additions & 3 deletions data_structures/2_Arrays/2_arrays_exercise.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Create a list to store these monthly expenses and using that find out,
got a refund of 200$. Make a correction to your monthly expense list
based on this

[Solution](https://github.com/codebasics/py/blob/master/DataStructures/2_Arrays/Solution/1_expenses.py)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/2_Arrays/Solution/1_expenses.py)

2. You have a list of your favourite marvel super heros.
```
Expand All @@ -35,11 +35,11 @@ Using this find out,
Do that with one line of code.
5. Sort the heros list in alphabetical order (Hint. Use dir() functions to list down all functions available in list)

[Solution](https://github.com/codebasics/py/blob/master/DataStructures/2_Arrays/Solution/2_marvel.py)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/2_Arrays/Solution/2_marvel.py)


3. Create a list of all odd numbers between 1 and a max number.
Max number is something you need to take from a user using input() function

[Solution](https://github.com/codebasics/py/blob/master/DataStructures/2_Arrays/Solution/3_odd_even_numbers.py)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/2_Arrays/Solution/3_odd_even_numbers.py)

8 changes: 4 additions & 4 deletions data_structures/3_LinkedList/3_linked_list_exercise.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Exercise: Linked List

1. In [LinkedList class](https://github.com/codebasics/py/blob/master/DataStructures/3_LinkedList/3_linked_list.py) that we implemented in our tutorial add following two methods,
1. In [LinkedList class](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/3_LinkedList/3_linked_list.py) that we implemented in our tutorial add following two methods,
```
def insert_after_value(self, data_after, data_to_insert):
# Search for first occurance of data_after value in linked list
Expand All @@ -26,7 +26,7 @@ Now make following calls,
ll.remove_by_value("grapes")
ll.print()
```
[Solution](https://github.com/codebasics/py/blob/master/DataStructures/3_LinkedList/Solution/singly_linked_list_exercise.py)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/3_LinkedList/Solution/singly_linked_list_exercise.py)

2. Implement doubly linked list. The only difference with regular linked list is that double linked has prev node reference as well. That way you can iterate in forward and backward direction.
Your node class will look this this,
Expand All @@ -45,6 +45,6 @@ def print_forward(self):
def print_backward(self):
# Print linked list in reverse direction. Use node.prev for this.
```
Implement all other methods in [regular linked list class](https://github.com/codebasics/py/blob/master/DataStructures/3_LinkedList/3_linked_list.py) and make necessary changes for doubly linked list (you need to populate node.prev in all those methods)
Implement all other methods in [regular linked list class](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/3_LinkedList/3_linked_list.py) and make necessary changes for doubly linked list (you need to populate node.prev in all those methods)

[Solution](https://github.com/codebasics/py/blob/master/DataStructures/3_LinkedList/Solution/doubly_linked_list_exercise.py)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/3_LinkedList/Solution/doubly_linked_list_exercise.py)
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
# Exercise: Hash Table

1. [nyc_weather.csv](https://github.com/codebasics/py/blob/master/DataStructures/4_HashTable_2_Collisions/Solution/nyc_weather.csv) contains new york city weather for first few days in the month of January. Write a program that can answer following,
1. [nyc_weather.csv](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/4_HashTable_2_Collisions/Solution/nyc_weather.csv) contains new york city weather for first few days in the month of January. Write a program that can answer following,
1. What was the average temperature in first week of Jan
1. What was the maximum temperature in first 10 days of Jan

Figure out data structure that is best for this problem

[Solution](https://github.com/codebasics/py/blob/master/DataStructures/4_HashTable_2_Collisions/Solution/weather_analysis.ipynb)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/4_HashTable_2_Collisions/Solution/weather_analysis.ipynb)

2. [nyc_weather.csv](https://github.com/codebasics/py/blob/master/DataStructures/4_HashTable_2_Collisions/Solution/nyc_weather.csv) contains new york city weather for first few days in the month of January. Write a program that can answer following,
2. [nyc_weather.csv](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/4_HashTable_2_Collisions/Solution/nyc_weather.csv) contains new york city weather for first few days in the month of January. Write a program that can answer following,
1. What was the temperature on Jan 9?
1. What was the temperature on Jan 4?

Figure out data structure that is best for this problem

[Solution](https://github.com/codebasics/py/blob/master/DataStructures/4_HashTable_2_Collisions/Solution/weather_analysis.ipynb)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/4_HashTable_2_Collisions/Solution/weather_analysis.ipynb)

3. [poem.txt](https://github.com/codebasics/py/blob/master/DataStructures/4_HashTable_2_Collisions/Solution/poem.txt) Contains famous poem "Road not taken" by poet Robert Frost. You have to read this file in python and print every word and its count as show below. Think about the best data structure that you can use to solve this problem and figure out why you selected that specific data structure.
3. [poem.txt](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/4_HashTable_2_Collisions/Solution/poem.txt) Contains famous poem "Road not taken" by poet Robert Frost. You have to read this file in python and print every word and its count as show below. Think about the best data structure that you can use to solve this problem and figure out why you selected that specific data structure.
```
'diverged': 2,
'in': 3,
'I': 8
```

[Solution](https://github.com/codebasics/py/blob/master/DataStructures/4_HashTable_2_Collisions/Solution/exercise_poem_find_word_occurances.ipynb)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/4_HashTable_2_Collisions/Solution/exercise_poem_find_word_occurances.ipynb)

4. Implement hash table where collisions are handled using linear probing. We learnt about linear probing in the video tutorial. Take the hash table implementation that uses chaining and modify methods to use **linear probing**. Keep MAX size of arr in hashtable as 10.

[Solution](https://github.com/codebasics/py/blob/master/DataStructures/4_HashTable_2_Collisions/Solution/exercise_hash_table_linear_probing.ipynb)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/4_HashTable_2_Collisions/Solution/exercise_hash_table_linear_probing.ipynb)

2 changes: 1 addition & 1 deletion data_structures/6_Queue/6_queue_exercise.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Data structure tutorial exercise: Queue

For all exercises use [Queue class](https://github.com/codebasics/py/blob/master/DataStructures/6_Queue/6_queue.ipynb) implemented in main tutorial.
For all exercises use [Queue class](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/6_Queue/6_queue.ipynb) implemented in main tutorial.

1. Design a food ordering system where your python program will run two threads,
1. Place Order: This thread will be placing an order and inserting that into a queue. This thread places new order every 0.5 second. (hint: use time.sleep(0.5) function)
Expand Down
6 changes: 3 additions & 3 deletions data_structures/7_Tree/7_tree_exercise.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

![ss](management_both.PNG)

Extent [tree class](https://github.com/codebasics/py/blob/master/DataStructures/7_Tree/7_tree.py) built in our
Extent [tree class](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/7_Tree/7_tree.py) built in our
main tutorial so that it takes **name** and **designation** in data part of TreeNode class.
Now extend print_tree function such that it can print either name tree, designation tree or name and designation tree. As shown below,

Expand All @@ -19,7 +19,7 @@ if __name__ == '__main__':
root_node.print_tree("both") # prints both (name and designation) hierarchy
```

[Solution](https://github.com/codebasics/py/blob/master/DataStructures/7_Tree/Exercise/management_hierarchy.py)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/7_Tree/Exercise/management_hierarchy.py)

2. Build below location tree using **TreeNode** class

Expand All @@ -29,6 +29,6 @@ Now modify print_tree method to take tree level as input. And that should print

![](location_trees_all.png)

[Solution](https://github.com/codebasics/py/blob/master/DataStructures/7_Tree/Exercise/location_hierarchy.py)
[Solution](https://github.com/codebasics/data-structures-algorithms-python/blob/master/data_structures/7_Tree/Exercise/location_hierarchy.py)