sudheerj/datastructures-algorithms
770 GitHub stars and counting — sudheerj/datastructures-algorithms is a Java project TopGit is tracking across repositories on the platform. List of Programs related to data structures and algorithms
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Snapshot
Top contributors
Show top contributors
Data Structures and Algorithms
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.
Overview
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.
Data Structures
Stack
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Stack using array | Source | JavaScript | - | Easy | Using Array operations | Use array push/pop for stack behavior |
| 2 | Stack using linkedlist | Source | JavaScript | - | Easy | Using LinkedList operations | Use linked list nodes for stack push/pop |
Queue
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Queue using array | Source | JavaScript | Documentation | Easy | Using Array operations | Use array shift/unshift or circular buffer |
| 2 | Queue using linkedlist | Source | JavaScript | Documentation | Easy | Using LinkedList operations | Maintain head/tail pointers for enqueue/dequeue |
SinglyLinkedList
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | SinglyLinkedList implementation | Source | JavaScript | Documentation | Easy | Linked List operations | Use nodes with next pointer for insert/delete |
DoublyLinkedList
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | DoublyLinkedList implementation | Source | JavaScript | Documentation | Easy | Linked List operations | Use nodes with prev/next pointers for insert/delete |
Tree
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Binary Search Tree | Source | JavaScript | Documentation | Medium | Tree operations | Use left/right pointers, recursive insert/search |
Graphs
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Unweighted undirected graph | Source | JavaScript | Documentation | Medium | Graph operations | Use adjacency list/matrix for traversal |
HashTable
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | HashTable | Source | JavaScript | - | Medium | Hash operations | Use hash function for key-value storage |
Algorithms
Array
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Contains duplicates | Source | Playground | Documentation | Easy | Set/Object | Verify duplicate using set or map/dict/object |
| 2 | Two sum2- Input array sorted | Source | Playground | Documentation | Medium | Two pointers | Use left/right pointers to find target sum |
| 3 | 3 sum | Source | Playground | Documentation | Medium | Two pointers | Sort, fix one element, use two pointers for others |
| 4 | Product of array except self | Source | Playground | Documentation | Medium | Prefix and postfix pattern | Compute left and right products for each index |
| 5 | Max sum subarray | Source | Playground | Documentation | Medium | Kadane's algorithm | Track max sum ending at each index |
| 6 | Minimum size subarray sum | Source | Playground | Documentation | Medium | Sliding window | Expand/shrink window to meet sum |
| 7 | Sort Colors | Source | Playground | Documentation | Medium | Two pointers | Dutch National Flag: 3-way partition |
| 8 | Maximum product subarray | Source | Playground | Documentation | Medium | Kadane's algorithm | Track max/min products at each index |
| 9 | Find minimum in rotated sorted array | Source | Playground | Documentation | Medium | Binary search technique | Use binary search to find inflection point |
| 10 | Maximum Circular subarray | Source | Playground | Documentation | Medium | Kadane's algorithm | Max of normal and circular subarray sum |
| 11 | Rotate array | Source | Playground | Documentation | Medium | Two pointers | Reverse parts and whole array |
| 12 | Search in rotated sorted array | Source | Playground | Documentation | Medium | Binary search | Modified binary search for rotation |
| 13 | Container with most water | Source | Playground | Documentation | Medium | Two pointers | Calculate max area and move shorter pointer inward |
| 14 | First missing positive number | Source | JavaScript | Documentation | Hard | In-place hashing | Place numbers at correct indices |
| 15 | Best time to buy stock and sell stock | Source | JavaScript | Documentation | Easy | Greedy algorithm | Look for minprice at each position |
| 16 | Two missing numbers | Source | JavaScript | Documentation | Medium | Sum and average calculations | Use sum and sum of squares to find missing |
| 17 | Pascal's Triangle | Source | JavaScript | Documentation | Easy | Array traversal and sequential sum | Build each row using previous row |
| 18 | Remove Element | Source | JavaScript | Documentation | Easy | Array traversal | Overwrite target elements in-place |
| 19 | Can place flowers | Source | JavaScript | Documentation | Easy | Array traversal and comparison | Check adjacent plots for placement |
| 20 | Majority Element | Source | JavaScript | Documentation | Easy | Boyer Moore Voting algorithm | Track candidate and count |
| 21 | Pivot Index | Source | JavaScript | Documentation | Easy | Array traversal | Compare left/right sums at each index |
| 22 | Range Sum queries | Source | JavaScript | Documentation | Easy | Array traversal | Precompute prefix sums for fast queries |
| 23 | Disappeared numbers | Source | JavaScript | Documentation | Easy | Array traversal | Mark visited indices, collect missing |
| 24 | Identical pairs | Source | JavaScript | Documentation | Easy | Array traversal & map | Count occurrences, use nC2 formula |
| 25 | Destination City | Source | JavaScript | Documentation | Easy | Array traversal & set | Find city with no outgoing path |
| 26 | Set mismatch | Source | JavaScript | Documentation | Easy | Array traversal & marking numbers | Find duplicate and missing |
| 27 | Intersection of arrays | Source | JavaScript | Documentation | Easy | Set and array traversal | Use sets for intersection |
| 29 | Special array | Source | JavaScript | Documentation | Easy | Frequency counter and array traversal | Check for special property by counting frequencies |
| 30 | Max length between equal chars | Source | JavaScript | Documentation | Easy | Array traversal | Store first/last index of each char |
| 31 | Third largest element | Source | JavaScript | Documentation | Easy | Array traversal | Track top 3 elements |
| 32 | Odd occurrences | Source | JavaScript | Documentation | Easy | XOR operation | XOR all elements to find odd occurrence |
| 33 | Max counters | Source | JavaScript | Documentation | Medium | Lazy update strategy | Use lazy update to avoid repeated operations |
| 34 | Tape equilibrium | Source | JavaScript | Documentation | Easy | Prefix sum | Track left/right sums, find min difference |
| 35 | Perm check | Source | JavaScript | Documentation | Easy | Set operations | Check if all numbers from 1 to N are present |
| 36 | Equi leader | Source | JavaScript | Documentation | Medium | Boyer-Moore algorithm | - |
| 37 | Count triangles | Source | JavaScript | Documentation | Medium | Two pointers | - |
| 38 | Min abs sum of two | Source | JavaScript | Documentation | Medium | Two pointers | - |
| 39 | Abs distinct | Source | JavaScript | Documentation | Easy | Two pointers | - |
| 40 | Count distinct slices | Source | JavaScript | Documentation | Medium | Sliding window | - |
| 41 | Best time to buy and sell stock II | Source | JavaScript | Documentation | Medium | Greedy algorithm | Accumulate all positive daily price differences |
| 42 | Move zeros | Source | - | - | Easy | Two pointers | Swap non-zeros forward, zeros settle at end |
String
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Longest substring without repeating characters | Source | JavaScript | Documentation | Medium | Sliding Window | set to remove duplicates or map/dict with (char,index) key-value pairs to jump position |
| 2 | Longest repeating character replacement | Source | JavaScript | Documentation | Medium | Sliding Window | char frequency dict/map/array with windowLength-maxFrequency > k check |
| 3 | Minimum window substring | Source | JavaScript | Documentation | Hard | Sliding Window | Two char frequecies map/dict for finding minimum length based on having == required |
| 4 | Valid anagram | Source | JavaScript | Documentation | Easy | Frequency counting | Balancing char frequency list |
| 5 | Group anagrams | Source | JavaScript | Documentation | Medium | Frequency counting | Group anagrams based on unique key(counter or sorted) |
| 6 | Valid palindrome | Source | JavaScript | Documentation | Easy | Two pointer | Compare two strings using two pointers |
| 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 | - |
Dynamic programming
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Climbing stairs | Source | JavaScript | Documentation | Medium | Dynamic programming | Use DP to build up the number of ways to reach each step from previous two steps. |
| 2 | Coin change | Source | JavaScript | Documentation | Medium | Dynamic programming | For each amount, try every coin and use DP to find the minimum coins needed. |
| 3 | Longest increasing subsequence | Source | JavaScript | Documentation | Medium | Dynamic programming (Bottom up) | For each element, find the longest increasing subsequence ending at that element. |
| 4 | Longest common subsequence | Source | JavaScript | Documentation | Medium | Two-dimentional bottom up Dynamic programming | Use a DP table to track the longest subsequence for all prefixes of both strings. |
| 5 | Word break | Source | JavaScript | Source | Medium | Bottom up dynamic programming | For each index, check if any word in the dictionary ends there and the prefix is breakable. |
| 6 | Combination Sum 4 | Source | JavaScript | Documentation | Medium | Bottom up Dynamic programming | For each total, sum the ways to reach it using all numbers in the array. |
| 7 | House robber | Source | JavaScript | Documentation | Medium | Fibonacci pattern bottom-up dynamic programming | At each house, choose max of robbing it plus two houses back or skipping it. |
| 8 | House robber 2 | Source | JavaScript | Documentation | Medium | Bottom-up dynamic programming | Like House Robber, but first and last houses are adjacent, so solve twice (excluding each end). |
| 9 | Decode ways | Source | JavaScript | Documentation | Medium | Dynamic programming | For each position, sum the ways to decode one or two digits if valid. |
| 10 | Unique paths | Source | JavaScript | Documentation | Medium | Dynamic programming | Use DP to count ways to reach each cell from top or left. |
| 11 | Jump game | Source | JavaScript | Documentation | Medium | Dynamic programming or Greedy | Track the farthest index you can reach at each step. |
| 12 | Min abs sum | Source | JavaScript | Documentation | Medium | Dynamic programming | Use DP to partition numbers into two groups with minimal absolute difference. |
| 13 | Number solitaire | Source | JavaScript | Documentation | Medium | Dynamic programming | At each cell, choose the best score from the previous 6 cells plus current value. |
Binary
| No. | Name | Source | Playground | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Sum of two integers | Source | JavaScript | Documentation | Medium | Bitwise operations | Use bitwise operations to add without using '+'. |
| 2 | Number of 1 Bits | Source | JavaScript | Documentation | Easy | Brian Kernighans | Repeatedly clear the lowest set bit using n & (n-1). |
| 3 | Counting Bits | Source | JavaScript | Documentation | Easy | Dynamic programming | For each number, count bits as 1 + bits in n & (n-1). |
| 4 | Missing number | Source | JavaScript | Documentation | Easy | Bitwise XOR | - |
| 5 | Reverse Bits | Source | JavaScript | Documentation | Easy | Bitwise operations | - |
Stack
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Sort Stack | Source | JavaScript | Documentation | Easy | Stack push & pop | Use an auxiliary stack to insert elements in sorted order. |
| 2 | Balanced Brackets | Source | JavaScript | Documentation | Medium | Stack push and pop | Push opening brackets, pop and check for matching closing brackets. |
| 3 | Reverse Polish Notation | Source | JavaScript | Documentation | Medium | Stack push & pop | Push operands, pop two for each operator, compute and push result. |
| 4 | Daily Temperatures | Source | JavaScript | Documentation | Medium | Monotonic decreasing stack | Use stack to keep indices, pop when a warmer day is found. |
| 5 | Number of People See In Queue | Source | JavaScript | Documentation | Medium | Monotonic decreasing stack | Use stack to count visible people for each position. |
LinkedList
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Reverse sublist | Source | JavaScript | Documentation | Easy | List traversal | Reverse pointers between left and right positions. |
| 2 | Detect cycle in a linkedlist | Source | JavaScript | Documentation | Easy | Floyd's cycle-finding algorithm | Use slow and fast pointers to detect a cycle. |
| 3 | Merge two sorted lists | Source | JavaScript | Documentation | Easy | Arithmetic comparison | Compare heads, attach smaller node, repeat. |
| 4 | Merge K sorted lists | Source | JavaScript | Documentation | Hard | Divide and conquer | Merge pairs of lists recursively or use a min-heap. |
| 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 | - |
DoublyLinkedList
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Swap first and last | Source | JavaScript | Documentation | Easy | Swap nodes | Swap head and tail node values. |
| 2 | Palindrome check | Source | JavaScript | Documentation | Easy | Two pointers | - |
| 3 | Swap node pairs | Source | JavaScript | Documentation | Medium | List traversal and pointer updates | - |
Tree
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Maximum depth of binary tree | Source | JavaScript | Documentation | Easy | DFS with recursion | Recursively find max depth of left and right subtrees. |
| 2 | Same tree | Source | JavaScript | Documentation | Easy | DFS with recursion | Recursively compare values and subtrees of both trees. |
| 3 | Invert or Flip binary tree | Source | JavaScript | Documentation | Easy | DFS with recursion | Recursively swap left and right children of each node. |
| 4 | Binary tree maximum path sum | Source | JavaScript | Documentation | Hard | DFS using recursion | At each node, compute max path sum including or excluding the node. |
| 5 | Binary tree level order traversal | Source | JavaScript | Documentation | Easy | BFS traversal | Use a queue to traverse nodes level by level. |
| 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 | - |
Graph
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 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 | - |
| 9 | Fib frog | Source | JavaScript | Documentation | Medium | Dynamic programming | - |
Matrix
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 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 | - |
Interval
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 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 | - |
| 6 | Meeting rooms 3 | Source | JavaScript | Documentation | Medium | Greedy algorithm | Two minheaps + greedy scheduling + simulation |
| 7 | Max non-overlapping segments | Source | JavaScript | Documentation | Medium | Greedy algorithm | - |
HashTable
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 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 | - |
Sorting
| No. | Name | Source | Live | Documentation | Level | Complexity | Hint |
|---|---|---|---|---|---|---|---|
| 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) | - |
| 7 | Radix sort | Source | JavaScript | Documentation | Medium | TC: O(d(n+k)), SC: O(n+k) | - |
| 8 | Max product of three | Source | JavaScript | Documentation | Easy | Array sorting | - |
Misc
| No. | Name | Source | Live | Documentation | Level | Pattern | Hint |
|---|---|---|---|---|---|---|---|
| 1 | Frog jump | Source | JavaScript | Documentation | Easy | Mathematical calculation | - |
| 2 | Missing element | Source | JavaScript | Documentation | Easy | Mathematical calculation | - |
| 3 | Frog river one | Source | JavaScript | Documentation | Easy | Set operations | - |
| 4 | Count divisible | Source | JavaScript | Documentation | Easy | Mathematical calculation | - |
Related repositories
Quick answers
How active is development on sudheerj/datastructures-algorithms?
The most recent commit recorded on sudheerj/datastructures-algorithms was 8 days ago, based on the GitHub push timestamp. The repository has 227 forks — one of the better signals of community interest.
How does sudheerj/datastructures-algorithms compare to other Backend projects?
sudheerj/datastructures-algorithms is tracked by TopGit in the Backend category, with 770 GitHub stars and written in Java. Browse the Backend topic page on TopGit to compare it against similar projects by stars and activity.
How many stars does sudheerj/datastructures-algorithms have?
sudheerj/datastructures-algorithms has 770 GitHub stars — refresh the page for the live number, or check github.com/sudheerj/datastructures-algorithms. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What is sudheerj/datastructures-algorithms?
sudheerj/datastructures-algorithms (sudheerj/datastructures-algorithms) is a Java project on GitHub. From the project's own README: List of Programs related to data structures and algorithms
What language is sudheerj/datastructures-algorithms written in?
sudheerj/datastructures-algorithms is written primarily in Java. GitHub's language field is based on the largest share of bytes in the default branch.
What topics is sudheerj/datastructures-algorithms associated with?
GitHub's repository topics for sudheerj/datastructures-algorithms: "algorithm-challenges", "algorithms", "datastructures", "datastructures-algorithms", "dsa", "dsa-algorithm", "dynamic-programming", "graph", "interview", "java", "javascript", "leetcode", "linkedlist", "lodash", "polyfills", "prototype", "queue", "stack", "tree". TopGit's editorial category is Backend.
Why is sudheerj/datastructures-algorithms categorized under Backend?
TopGit places sudheerj/datastructures-algorithms in the Backend category based on its GitHub topics and description (tagged: "algorithm-challenges", "algorithms", "datastructures"). Categories are assigned from real repository metadata, not editorial guesswork.
Read full README in the tab above.