Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork179
sudheerj/datastructures-algorithms
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A comprehensive collection of data structures and algorithms implemented in multiple programming languages. This repository serves as a resource for learning and practicing fundamental computer science concepts.
This repository contains implementations of various data structures and algorithms, organized by category. Each implementation includes:
- Source code
- Interactive playground (where available)
- Documentation explaining the concept, approach, and complexity
The implementations are primarily in JavaScript, with some examples in other languages like Java, TypeScript, and Go.
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Stack using array | Source | JavaScript | - | Easy | Using Array operations |
2 | Stack using linkedlist | Source | JavaScript | - | Easy | Using LinkedList operations |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Queue using array | Source | JavaScript | Documentation | Easy | Using Array operations |
2 | Queue using linkedlist | Source | JavaScript | Documentation | Easy | Using LinkedList operations |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | SinglyLinkedList implementation | Source | JavaScript | Documentation | Easy | Linked List operations |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | DoublyLinkedList implementation | Source | JavaScript | Documentation | Easy | Linked List operations |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Binary Search Tree | Source | JavaScript | Documentation | Medium | Tree operations |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Unweighted undirected graph | Source | JavaScript | Documentation | Medium | Graph operations |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | HashTable | Source | JavaScript | - | Medium | Hash operations |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Contains duplicates | Source | Playground | Documentation | Easy | Set/Object |
2 | Two sum2- Input array sorted | Source | Playground | Documentation | Medium | Two pointers |
3 | 3 sum | Source | Playground | Documentation | Medium | Two pointers |
4 | Product of array except self | Source | Playground | Documentation | Medium | Prefix and postfix pattern |
5 | Max sum subarray | Source | Playground | Documentation | Medium | Kadane's algorithm |
6 | Minimum size subarray sum | Source | Playground | Documentation | Medium | Sliding window |
7 | Sort Colors | Source | Playground | Documentation | Medium | Two pointers |
8 | Maximum product subarray | Source | Playground | Documentation | Medium | Kadane's algorithm |
9 | Find minimum in rotated sorted array | Source | Playground | Documentation | Medium | Binary search technique |
10 | Maximum Circular subarray | Source | Playground | Documentation | Medium | Kadane's algorithm |
11 | Rotate array | Source | Playground | Documentation | Medium | Two pointers |
12 | Search in rotated sorted array | Source | Playground | Documentation | Medium | Binary search |
13 | Container with most water | Source | Playground | Documentation | Medium | Two pointers |
14 | First missing positive number | Source | JavaScript | Documentation | Hard | In-place hashing |
15 | Best time to buy stock and sell stock | Source | JavaScript | Documentation | Easy | Greedy algorithm |
16 | Two missing numbers | Source | JavaScript | Documentation | Medium | Sum and average calculations |
17 | Pascal's Triangle | Source | JavaScript | Documentation | Easy | Array traversal and sequential sum |
18 | Remove Element | Source | JavaScript | Documentation | Easy | Array traversal |
19 | Can place flowers | Source | JavaScript | Documentation | Easy | Array traversal and comparison |
20 | Majority Element | Source | JavaScript | Documentation | Easy | Boyer Moore Voting algorithm |
21 | Pivot Index | Source | JavaScript | Documentation | Easy | Array traversal |
22 | Range Sum queries | Source | JavaScript | Documentation | Easy | Array traversal |
23 | Disappeared numbers | Source | JavaScript | Documentation | Easy | Array traversal |
24 | Identical pairs | Source | JavaScript | Documentation | Easy | Array traversal & map |
25 | Destination City | Source | JavaScript | Documentation | Easy | Array traversal & set |
26 | Set mismatch | Source | JavaScript | Documentation | Easy | Array traversal & marking numbers |
27 | Intersection of arrays | Source | JavaScript | Documentation | Easy | Set and array traversal |
29 | Special array | Source | JavaScript | Documentation | Easy | Frequency counter and array traversal |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Longest substring without repeating characters | Source | JavaScript | Documentation | Medium | Sliding Window |
2 | Longest repeating character replacement | Source | JavaScript | Documentation | Medium | Sliding Window |
3 | Minimum window substring | Source | JavaScript | Documentation | Hard | Sliding Window |
4 | Valid anagram | Source | JavaScript | Documentation | Easy | Frequency counting |
5 | Group anagrams | Source | JavaScript | Documentation | Medium | Frequency counting |
6 | Valid palindrome | Source | JavaScript | Documentation | Easy | Two pointer |
7 | Longest palindromic substring | Source | JavaScript | Documentation | Medium | Expanding around center |
8 | Palindromic substrings | Source | JavaScript | Documentation | Medium | Expanding around center |
9 | Encode and decode strings | Source | JavaScript | Documentation | Medium | Basic string and array operations |
10 | Greatest common devisor of strings | Source | JavaScript | Documentation | Easy | Euclidean and String operations |
11 | Reverse words in string | Source | JavaScript | Documentation | Medium | Basic string and array operations |
12 | Length of last word | Source | JavaScript | Documentation | Easy | String traversal |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Climbing stairs | Source | JavaScript | Documentation | Medium | Dynamic programming |
2 | Coin change | Source | JavaScript | Documentation | Medium | Dynamic programming |
3 | Longest increasing subsequence | Source | JavaScript | Documentation | Medium | Dynamic programming(Bottom up) |
4 | Longest common subsequence | Source | JavaScript | Documentation | Medium | Two-dimentional bottom up Dynamic programming |
5 | Word break | Source | JavaScript | Source | Medium | Bottom up dynamic programming |
6 | Combination Sum 4 | Source | JavaScript | Documentation | Medium | Bottom up Dynamic programming |
7 | House robber | Source | JavaScript | Documentation | Medium | Fibonacci pattern bottom-up dynamic programming |
8 | House robber 2 | Source | JavaScript | Documentation | Medium | Bottom-up dynamic programming |
9 | Decode ways | Source | JavaScript | Documentation | Medium | Dynamic programming |
10 | Unique paths | Source | JavaScript | Documentation | Medium | Dynamic programming |
11 | Jump game | Source | JavaScript | Documentation | Medium | Dynamic programming or Greedy |
No. | Name | Source | Playground | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Sum of two integers | Source | JavaScript | Documentation | Medium | Bitwise operations |
2 | Number of 1 Bits | Source | JavaScript | Documentation | Easy | Brian Kernighans |
3 | Counting Bits | Source | JavaScript | Documentation | Easy | Dynamic programming |
4 | Missing number | Source | JavaScript | Documentation | Easy | Bitwise XOR |
5 | Reverse Bits | Source | JavaScript | Documentation | Easy | Bitwise operations |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Sort Stack | Source | JavaScript | Documentation | Easy | Stack push & pop |
2 | Balanced Brackets | Source | JavaScript | Documentation | Medium | Stack push and pop |
3 | Reverse Polish Notation | Source | JavaScript | Documentation | Medium | Stack push & pop |
4 | Daily Temperatures | Source | JavaScript | Documentation | Medium | Monotonic decreasing stack |
5 | Number of People See In Queue | Source | JavaScript | Documentation | Medium | Monotonic decreasing stack |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Reverse sublist | Source | JavaScript | Documentation | Easy | List traversal |
2 | Detect cycle in a linkedlist | Source | JavaScript | Documentation | Easy | Floyd's cycle-finding algorithm |
3 | Merge two sorted lists | Source | JavaScript | Documentation | Easy | Arithmetic comparison |
4 | Merge K sorted lists | Source | JavaScript | Documentation | Hard | Divide and conquer |
5 | Remove Kth node from end of list | Source | JavaScript | Documentation | Medium | Two pointers |
6 | Reorder list | Source | JavaScript | Documentation | Medium | Two pointers |
7 | Find middle node | Source | JavaScript | Documentation | Easy | Two pointers |
8 | Find Kth node from end of list | Source | JavaScript | Documentation | Easy | Two pointers |
9 | Partition list | Source | JavaScript | Documentation | Medium | Two pointers |
10 | Remove duplicates | Source | JavaScript | Documentation | Easy | Two pointers |
11 | Binary to decimal | Source | JavaScript | Documentation | Easy | List traversal and math operations |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Swap first and last | Source | JavaScript | Documentation | Easy | Swap nodes |
2 | Palindrome check | Source | JavaScript | Documentation | Easy | Two pointers |
3 | Swap node pairs | Source | JavaScript | Documentation | Medium | List traversal and pointer updates |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Maximum depth of binary tree | Source | JavaScript | Documentation | Easy | DFS with recursion |
2 | Same tree | Source | JavaScript | Documentation | Easy | DFS with recursion |
3 | Invert or Flip binary tree | Source | JavaScript | Documentation | Easy | DFS with recursion |
4 | Binary tree maximum path sum | Source | JavaScript | Documentation | Hard | DFS using recursion |
5 | Binary tree level order traversal | Source | JavaScript | Documentation | Easy | BFS traversal |
6 | Serialize and deserialize binary tree | Source | JavaScript | Documentation | Hard | DFS preorder traversal |
7 | Subtree of another tree | Source | JavaScript | Documentation | Easy | DFS with recursion |
8 | Construct binary tree from traversals | Source | JavaScript | Documentation | Medium | DFS with recursion |
9 | Validate BST | Source | JavaScript | Documentation | Medium | DFS using recursion |
10 | Kth smallest element in BST | Source | JavaScript | Documentation | Medium | Inorder traversal |
11 | Lowest Common Ancestor of BST | Source | JavaScript | Documentation | Medium | Tree traversal |
12 | Trie | Source | JavaScript | Documentation | Medium | String character iteration |
13 | Design and Search words Datastructure | Source | JavaScript | Documentation | Medium | Trie and DFS recursion |
14 | Word search 2 | Source | JavaScript | Documentation | Hard | Backtracking with Trie |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Clone graph | Source | JavaScript | Documentation | Medium | DFS using recursion |
2 | Course schedule | Source | JavaScript | Documentation | Medium | DFS using recursion |
3 | Pacific Atlantic waterflow | Source | JavaScript | Documentation | Medium | DFS using recursion |
4 | Number of Islands | Source | JavaScript | Documentation | Medium | DFS using recursion |
5 | Alien dictionary | Source | JavaScript | Documentation | Hard | Topological sorting |
6 | Graph valid tree | Source | JavaScript | Documentation | Medium | Union Find algorithm |
7 | Number of connected components | Source | JavaScript | Documentation | Medium | Union Find algorithm |
8 | Walls and gates | Source | JavaScript | Documentation | Medium | BFS traversal |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Set matrix zeros | Source | JavaScript | Documentation | Medium | In-place updates |
2 | Spiral matrix | Source | JavaScript | Documentation | Medium | Boundary traversal |
3 | Rotate image | Source | JavaScript | Documentation | Medium | In-place rotation |
4 | Word search | Source | JavaScript | Documentation | Medium | DFS using recursion |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Insert interval | Source | JavaScript | Documentation | Medium | Math operations |
2 | Merge interval | Source | JavaScript | Documentation | Medium | Sorting and math operations |
3 | Non-overlapping intervals | Source | JavaScript | Documentation | Medium | Greedy algorithm |
4 | Meeting rooms | Source | JavaScript | Documentation | Medium | Greedy algorithm |
5 | Meeting rooms 2 | Source | JavaScript | Documentation | Medium | Two pointers |
No. | Name | Source | Live | Documentation | Level | Pattern |
---|---|---|---|---|---|---|
1 | Duplicates | Source | JavaScript | Documentation | Easy | Using Map |
2 | Two sum | Source | JavaScript | Documentation | Easy | Using Map |
3 | First non repeating character | Source | JavaScript | Documentation | Easy | Using Map |
4 | Group anagrams | Source | JavaScript | Documentation | Medium | Map methods |
5 | Verify Common Elements | Source | JavaScript | Documentation | Easy | Map methods |
6 | Longest consecutive sequence | Source | JavaScript | Documentation | Medium | Set operations |
7 | Valid Sudoku | Source | JavaScript | Documentation | Medium | Map and Set methods |
8 | Letter combinations | Source | JavaScript | Documentation | Medium | Backtracking with hash mapping |
9 | LRU Cache | Source | JavaScript | Documentation | Medium | Hash Table with linked list |
10 | Maximum number of balloons | Source | JavaScript | Documentation | Easy | Character frequency map |
11 | Isomorphic Strings | Source | JavaScript | Documentation | Easy | Character mapping |
14 | First unique character | Source | JavaScript | Documentation | Easy | Character frequency count |
No. | Name | Source | Live | Documentation | Level | Complexity |
---|---|---|---|---|---|---|
1 | Bubble sort | Source | JavaScript | Documentation | Easy | TC: O(n²), SC: O(1) |
2 | Selection sort | Source | JavaScript | Documentation | Easy | TC: O(n²), SC: O(1) |
3 | Insertion sort | Source | JavaScript | Documentation | Easy | TC: O(n²), SC: O(1) |
4 | Merge sort | Source | JavaScript | Documentation | Medium | TC: O(n log n), SC: O(n) |
5 | Quick sort | Source | JavaScript | Documentation | Medium | TC: O(n²), SC: O(log n) |
6 | Heap sort | Source | JavaScript | Documentation | Hard | TC: O(n log n), SC: O(1) |
About
List of Programs related to data structures and algorithms
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.