https://github.com/dashroshan/dsa-using-python
📦 Implementation of data structures and algorithms using Python
https://github.com/dashroshan/dsa-using-python
algorithm data-structure python
Last synced: 8 months ago
JSON representation
📦 Implementation of data structures and algorithms using Python
- Host: GitHub
- URL: https://github.com/dashroshan/dsa-using-python
- Owner: dashroshan
- Created: 2022-01-13T14:34:57.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-16T08:06:15.000Z (almost 4 years ago)
- Last Synced: 2025-02-12T21:17:30.815Z (10 months ago)
- Topics: algorithm, data-structure, python
- Language: Python
- Homepage:
- Size: 406 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DSA using Python
**[YouTube tutorial playlist](https://www.youtube.com/playlist?list=PLeo1K3hjS3uu_n_a__MI_KktGTLYopZ12)** that I followed
## Big O
Big O analysis of some common DSA


## Static Arrays
It can store a fixed number of elements at subsequent memeory locations.
## Dynamic Arrays
**Ex : List in Python**
1. Location for `N` elements is created.
2. When elements exceed `N`, a location for `2N` elements is created and old elements copied to it.
3. When elements exceed `2N`, a location for `3N` elements is created and old elements copied to it.
and so on...
## Linked List
**Ex : Deque of Collections in Python**
Each node (element) points to the next node (also the previous node in case of doubly linked list). Nodes do not need to be present in subsequent memory locations.
## Hash Table
**Ex : Dictionary in Python**
Used with key-value pairs where each key passed through a hashing algorithm gives the memory location where the value is stored.
For different keys with same hash (collision):
1. Chaining : Multiple values stored in an array along with their keys in the same location.
2. Linear Probing : Go forward until the next empty location is found, store the keys too.
## Stack
Last in first out (LIFO)
## Queue
First in first out (FIFO)
## General Tree
Elements are stored in a hierarchial model where each element can have child elements and parent element.
## Binary Search Tree
Max 2 child elements. Element on left is less than parent. Element on right is greater than parent.
## Graph
It consists of interconnected nodes with a one or two way path, and the paths may have weights. Nodes store which other nodes they're connected to any by what path weight.
## Binary Search
Only works with sorted arrays
1. If middle element is the item, return it.
2. If middle element greater/less than item, continue with the sublist to the left/right accordingly.
## Bubble sort
Go over the array `N` times and during each pass, if the left element is greater than the right one, swap them.