Skip to content

Commit 7221ddc

Browse files
committed
Add Readme for DSA
1 parent 73558ed commit 7221ddc

File tree

5 files changed

+162
-5
lines changed

5 files changed

+162
-5
lines changed

README.md

+157
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,159 @@
11
# datastructures-algorithms
22
List of Programs related to data structures and algorithms
3+
4+
## Data Strctures
5+
6+
### Array
7+
8+
### Stack
9+
1. Stack using array: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/datastructures/stack/stack_with_array.js)
10+
11+
2. Stack using linkedlist: [JavaScript](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/datastructures/stack/stack_with_linkedlist.js)
12+
13+
### Queue
14+
1. Queue using array: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/datastructures/queue/queue_array.js)
15+
2. Queue using linkedlist: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/datastructures/queue/queue_with_linkedlist.js)
16+
3. Queue using stack: [JavaScript]()
17+
18+
### Linkedlist
19+
1. Linkedlist implementation: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/datastructures/linkedlist/class/linkedList.js)
20+
21+
### DoublyLinkedlist
22+
1. DoublyLinkedlist implementation: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/datastructures/doublyLinkedlist/class/doublyLinkedlist.js)
23+
24+
### Tree
25+
1. Binary Search Tree: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/datastructures/trees/binary_search_tree.js)
26+
27+
### Graphs
28+
29+
1. Unweighted undirected graph: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/datastructures/graphs/unweighted_undirected.js)
30+
31+
32+
## Algorithms
33+
34+
### Array
35+
36+
1. Contains duplicates : [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/array/containsDuplicate.js
37+
)
38+
2. Product of array except self: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/array/productExceptSelf.js)
39+
40+
3. Max sum subarray: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/array/maxSubArray.js)
41+
42+
4. Maximum product subarray: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/array/maxProductSubArray.js)
43+
44+
5. Find minimum in rotated sorted array: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/array/minRotatedSortedArray.js)
45+
46+
6. Maximum Circular subarray: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/array/maxCircularSubArray.js)
47+
48+
7. Rotate array: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/array/rotate.js)
49+
50+
8. Search in rotated sorted array: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/array/searchRotatedSortedArray.js)
51+
52+
9. 3 sum: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/array/threeSum.js)
53+
54+
10. Container with most water: [JavaScript](https://livecodes.io/?console=open&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/array/containerWithMostWater.js)
55+
56+
11. Best time to buy stock and sell stock: [JavaScript]()
57+
58+
### String
59+
60+
1. Longest substring without repeating characters: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/strings/longestSubstringWithoutRepeatingChar.js)
61+
62+
2. Longest repeating character replacement: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/strings/longestRepeatingCharReplacement.js)
63+
64+
3. Minimum window substring: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/strings/minWindowSubstring.js)
65+
66+
4. Valid anagram: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/strings/validAnagram.js)
67+
68+
5. Group anagrams: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/strings/groupAnagrams.js)
69+
70+
6. Valid parentheses: [JavaScript]()
71+
72+
7. Valid palindrome: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/strings/validPalindrome.js)
73+
74+
8. Longest palindromic substring: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/strings/longestPalindromicSubstring.js)
75+
76+
9. Palindromic substrings: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/strings/palindromicStrings.js)
77+
78+
10. Encode and decode strings: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/strings/encodeDecodeStrings.js)
79+
80+
11. Greatest common devisor of strings: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/strings/greatestCommonDivisor.js)
81+
82+
### Dynamic programming
83+
84+
1. Climbing stairs: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/dynamicProgramming/climbingStairs.js)
85+
86+
2. Coin change: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/dynamicProgramming/coinsChange.js)
87+
88+
3. Longest increasing subsequence: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/dynamicProgramming/longestIncreasingSequence.js)
89+
90+
4. Longest common subsequence: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/dynamicProgramming/longestCommonSubsequence.js)
91+
92+
5. Word break problem: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/dynamicProgramming/wordBreak.js)
93+
94+
6. Combination Sum 4: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/dynamicProgramming/combinationSum4.js)
95+
96+
7. House robber: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/dynamicProgramming/houseRobber.js)
97+
98+
8. House robber 2: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/dynamicProgramming/houseRobber2.js)
99+
100+
9. Decode ways: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/dynamicProgramming/numDecodingWays.js)
101+
102+
10. Unique paths: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/dynamicProgramming/uniquePaths.js)
103+
104+
11. Jump game: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/dynamicProgramming/jumpGame.js)
105+
106+
### Binary
107+
108+
1. Sum of two integers: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/twoSum.js)
109+
110+
2. Number of 1 Bits: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/numberOf1Bits.js)
111+
112+
3. Counting Bits: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/countingBits.js)
113+
114+
4. Missing number: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/missingNumber.js)
115+
116+
5. Reverse Bits: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/binary/reverseBits.js)
117+
118+
### LinkedList
119+
120+
1. Reverse substring: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/linkedlist/reverseSubstring.js)
121+
122+
2. Detect cycle in a linkedlist: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/linkedlist/detectLoop.js)
123+
124+
3. Merge two sorted lists: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/linkedlist/mergeTwoSortedLists.js)
125+
126+
4. Merge K sorted lists: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/linkedlist/mergeKSortedLists.js)
127+
128+
5. Remove Nth node from end of list: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/linkedlist/removeKthNodeFromEnd.js)
129+
130+
6. Reorder list: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/linkedlist/reorderList.js)
131+
132+
7. Find middle node: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/linkedlist/findMiddleNode.js)
133+
134+
8. Find Kth node from end of list: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/linkedlist/findKthNodeFromEnd.js)
135+
136+
9. Partition list: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/linkedlist/partitionList.js)
137+
138+
10. Remove duplicates: [JavaScript](https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/linkedlist/removeDuplicates.js)
139+
140+
11. Binary to decimal: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/linkedlist/binaryToDecimal.js)
141+
142+
143+
### Doubly linkedlist
144+
145+
1. Swap first and last: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/doublyLinkedlist/swapFirstAndLast.js)
146+
147+
2. Palindrome check: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/doublyLinkedlist/palindromeCheck.js)
148+
149+
3. Swap node pairs: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/doublyLinkedlist/SwapNodePairs.js)
150+
151+
#### Tree
152+
153+
1. Maximum depth of binary tree: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/tree/maxDepthBinaryTree.js)
154+
155+
2. Same tree: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/tree/sameTree.js)
156+
157+
3. Invert or Flip binary tree: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/tree/invertTree.js)
158+
159+
4. Binary tree maximum path sum: [JavaScript](https://livecodes.io/?console&x=https://github.com/sudheerj/datastructures-algorithms/blob/master/src/javascript/algorithms/tree/maxPathSum.js)

src/javascript/algorithms/array/maxSubArray.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ function maxSumSubarray(nums) {
99
}
1010

1111
let numbers = [1, 2, 3, 4, 5, 6, 7];
12-
let maxSumNumbers = maxSubarray(numbers);
12+
let maxSumNumbers = maxSumSubarray(numbers);
1313
console.log("Max Subarray Sum:", maxSumNumbers);
1414

1515
let emptyNumbers = [];
16-
let maxSumEmptyNumbers = maxSubarray(emptyNumbers);
16+
let maxSumEmptyNumbers = maxSumSubarray(emptyNumbers);
1717
console.log("Max Subarray Sum:", maxSumEmptyNumbers);

src/javascript/algorithms/doublyLinkedlist/SwapNodePairs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ myDoublyLinkedList.push(4);
6161
myDoublyLinkedList.push(5);
6262
myDoublyLinkedList.push(6);
6363

64-
myDoublyLinkedList.swapNodePairs();
64+
myDoublyLinkedList.swapPairs();

src/javascript/datastructures/queue/queue_with_linkedlist.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Queue {
5151
}
5252
}
5353

54-
const myQueue = new MyQueue("Zero");
54+
const myQueue = new Queue("Zero");
5555
myQueue.enqueue("One");
5656
myQueue.enqueue("Two");
5757
myQueue.enqueue("Three");

src/javascript/datastructures/stack/stack_with_linkedlist.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Stack {
3131
temp.next = null;
3232

3333
this.length--;
34-
return topNode;
34+
return temp;
3535
}
3636

3737
peek() {

0 commit comments

Comments
 (0)