This repository contains solutions to the exercises from the Udacity course on Data Structures and Algorithms in Python. Each folder in this repository corresponds to a different data structure or algorithm covered in the course.
-
stack/
Solutions to problems related to stack operations, such as implementing a stack, balancing parentheses, etc. -
queue/
Exercises related to queues, including FIFO operations, circular queues, and dequeue implementations. -
linked_list/
Solutions to exercises involving singly and doubly linked lists, such as reversing a linked list, detecting cycles, and merging sorted linked lists. -
tree/
Includes problems on various types of trees (binary tree, binary search tree, etc.), such as traversals (inorder, preorder, postorder), tree height, and finding the least common ancestor (LCA). -
graph/
Contains solutions to graph-based problems, such as breadth-first search (BFS), depth-first search (DFS), shortest path algorithms (Dijkstra's), and detecting cycles in a graph. -
sorting_algorithms/
Solutions for sorting algorithm problems such as bubble sort, merge sort, quicksort, and insertion sort. -
others/
Miscellaneous problems covering additional data structures and algorithms like heaps, hash tables, dynamic programming, and recursion.
-
Stacks
Basic stack operations, balancing parentheses, and stack-based problem-solving. -
Queues
Queue operations, circular queues, and use cases like the producer-consumer problem. -
Linked Lists
Singly and doubly linked lists, efficient manipulation, and memory management. -
Trees
Binary trees, binary search trees, AVL trees, and tree traversals (inorder, preorder, postorder). -
Graphs
Representations of graphs, BFS, DFS, shortest path algorithms, and topological sorting. -
Sorting Algorithms
Comparison-based sorts (bubble sort, quicksort, merge sort) and non-comparison sorts. -
Other Topics
Hashing, dynamic programming, recursion, heaps, and additional algorithms.
To run the Python scripts, you'll need Python 3.x installed on your machine. You can download Python from here.
To run a particular exercise, navigate to the corresponding folder and execute the Python file. For example, to run the linked list exercises:
cd LinkedList
python3 LinkedList_Exercise.pyEach solution file includes comments explaining the problem and the approach used to solve it.