Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/devparthgarg/Data-Structures-and-Algorithms
/ functions
Functions
1,161 in github.com/devparthgarg/Data-Structures-and-Algorithms
⨍
Functions
1,161
◇
Types & classes
111
↓ 1 callers
Function
nextGreater
time: O(n*n) space: O(1)
12. Stacks/09 Next Greater Element/09a Next Greater Element.cpp:6
↓ 1 callers
Function
nkOcc
09. Hashing/15 More than N-K Occurrences/15a More Than N k Occurences.cpp:9
↓ 1 callers
Function
nkOcc
09. Hashing/15 More than N-K Occurrences/15b More Than N k Occurences.cpp:9
↓ 1 callers
Function
nodesAtKDistance
Time: O(N) Space: O(H) K values: [0,Height-1]
15. Binary Tree/08 Print Nodes at K Distance/08.cpp:22
↓ 1 callers
Function
nodesAtKDistance
15. Binary Tree/10 Level Order Traversal Line by Line/10a.cpp:29
↓ 1 callers
Function
nodesAtKDistance
15. Binary Tree/09 Level Order Traversal/09a.cpp:29
↓ 1 callers
Function
oneOddOccuring
Time: O(n)
03. Bit Manipulation/05 One Odd Occurring/05 one odd occurring.cpp:10
↓ 1 callers
Function
pairSum
09. Hashing/07 Pair Sum/07b Pair with given Sum.cpp:4
↓ 1 callers
Function
pairSum
09. Hashing/07 Pair Sum/07a Pair with given Sum.cpp:4
↓ 1 callers
Function
pairSwap
Time: O(N) Space: O(1)
11. Linked List/37 Pairwise Node Swap of LL/37 Pairwise Node Swap of LL.cpp:19
↓ 1 callers
Function
palindrome
Time: O(N) Space: O(1)
11. Linked List/41 Palindrome Linked List/41 Palindrome Linked List.cpp:35
↓ 1 callers
Function
palindrome
04. Recursion/09 Check Palindrome/09 Palindrome Check using Recursion.cpp:7
↓ 1 callers
Function
patternSearch
Time: O(n^2) Space: O(1)
10. Strings/16 Pattern Searching/16a Naive Pattern Searching.cpp:6
↓ 1 callers
Function
patternSearch
naive method
10. Strings/16 Pattern Searching/16b Naive Pattern Searching.cpp:5
↓ 1 callers
Function
peak
06. Searching/09 Peak Element/09b peak element.cpp:4
↓ 1 callers
Function
peak
06. Searching/09 Peak Element/09a peak element.cpp:13
↓ 1 callers
Function
permutations
20. Backtracking/01 Print Permutations of Strings with Given Condition/01a Print Permutations of Strings with Given Condition.cpp:9
↓ 1 callers
Function
permutations
Backtracking based solution
20. Backtracking/01 Print Permutations of Strings with Given Condition/01b Print Permutations of Strings with Given Condition.cpp:25
↓ 1 callers
Function
permutations
04. Recursion/16 Printing All Permutations/16 Printing All Permutations.cpp:4
↓ 1 callers
Function
postorder
Time: O(N) Space: O(H) Postorder: Left Right Root
15. Binary Tree/06 Postorder Traversal/06.cpp:22
↓ 1 callers
Function
powerSet
03. Bit Manipulation/07 Power Set using Bitwise Operators/07 generate power set.cpp:4
↓ 1 callers
Function
prefixSum
05. Arrays/26 Find Query Sum/26b Find Query Sum.cpp:6
↓ 1 callers
Function
preorder
Time: O(N) Space: O(H) Preorder: Root Left Right
15. Binary Tree/05 Preorder Traversal/05.cpp:22
↓ 1 callers
Function
print
Time: O(N) Space: O(1)
11. Linked List/11 Doubly Linked List Class/11 Doubly Linked List Class.cpp:21
↓ 1 callers
Function
print
11. Linked List/26 Find Nth Node From End Of LL/26a Find Nth Node From End Of LL.cpp:54
↓ 1 callers
Function
print
11. Linked List/26 Find Nth Node From End Of LL/26b Find Nth Node From End Of LL.cpp:43
↓ 1 callers
Function
print
Time: O(N) Space: O(1)
11. Linked List/02 Iterative Traversal/02 Iterative Traversal.cpp:19
↓ 1 callers
Function
print
11. Linked List/10 Recursive Search/10 Recursive Search.cpp:41
↓ 1 callers
Function
print
Time: O(N) Space: O(1)
11. Linked List/18 Traversing Circular LL/18 Traversing Ciruclar LL.cpp:19
↓ 1 callers
Function
print
11. Linked List/33 Detect and Remove Loop/33 Detect and Remove Loop.cpp:53
↓ 1 callers
Function
print
11. Linked List/09 Iterative Search/09 Iterative Search.cpp:36
↓ 1 callers
Function
print
11. Linked List/25 Middle Of Linked List/25b Middle Of Linked List.cpp:38
↓ 1 callers
Function
print
11. Linked List/25 Middle Of Linked List/25a Middle Of Linked List.cpp:41
↓ 1 callers
Function
print
Time: O(N) Space: O(N)
11. Linked List/03 Recursive Traversal/03 Recursive Traversal.cpp:19
↓ 1 callers
Function
print
11. Linked List/41 Palindrome Linked List/41 Palindrome Linked List.cpp:72
↓ 1 callers
Function
print
18. Graphs/03 Graphs Implementation/03b Graphs Implementation.cpp:11
↓ 1 callers
Function
print
04. Recursion/04 Print 1 to N/04 Print 1 to N.cpp:7
↓ 1 callers
Function
print
04. Recursion/03 Print N to 1/03 Print N to 1.cpp:7
↓ 1 callers
Method
print
print matrix
18. Graphs/03 Graphs Implementation/03a Graphs Implementation.cpp:44
↓ 1 callers
Function
printArray
17. Heaps/09 Heap Sort/09 Heap Sort.cpp:38
↓ 1 callers
Function
printDLL
15. Binary Tree/17 Convert Binary Tree to Doubly Linked List/17.cpp:19
↓ 1 callers
Function
printFrequencies
time: O(n*n)
05. Arrays/14 Frequencies in Sorted Array/14a Frequencies in Sorted Array.cpp:5
↓ 1 callers
Function
printFrequencies
time: O(n) (i incremented in both loops)
05. Arrays/14 Frequencies in Sorted Array/14b Frequencies in Sorted Array.cpp:5
↓ 1 callers
Function
printLeft
15. Binary Tree/13 Left View of Binary Tree/13b.cpp:29
↓ 1 callers
Function
printNumbers
13. Queue/06_Generate_Number_with_Given_Digits.cpp:9
↓ 1 callers
Function
printPrevGreater
time: O(n) space: O(n)
12. Stacks/08 Previous Greater Element/08b Previous Greater Element.cpp:6
↓ 1 callers
Function
printPrevGreater
time: O(n*n) space: O(1)
12. Stacks/08 Previous Greater Element/08a Previous Greater Element.cpp:6
↓ 1 callers
Function
printSnake
08. Matrix/02 Snake Pattern/02 Snake Pattern.cpp:5
↓ 1 callers
Function
printSolution
20. Backtracking/02 Rat in a Maze/02 Rat in a Maze.cpp:10
↓ 1 callers
Function
printSpan
time: O(n*n) space: O(1)
12. Stacks/07 Stock Span Problem/07a Stock Span Problem.cpp:6
↓ 1 callers
Function
printSpan
time: O(n) space: O(n) span=idx_curr_ele - idx_previous_greater_ele (in case of no previous greater than add 1 in curr_ele idx)
12. Stacks/07 Stock Span Problem/07b Stock Span Problem.cpp:8
↓ 1 callers
Function
quickSort
07. Sorting/15 Quick Sort/15b Quick Sort using Lomuto Partition.cpp:24
↓ 1 callers
Function
quickSort
07. Sorting/15 Quick Sort/15c Quick Sort using Hoare Partition.cpp:32
↓ 1 callers
Function
removeDuplicate
Time: O(n)
05. Arrays/08 Remove Duplicates from Sorted Array/08 Remove Duplicates from Sorted Array.cpp:5
↓ 1 callers
Function
removeDuplicates
Time: O(N) Space: O(1)
11. Linked List/29 Remove Duplicates from Sorted LL/29 Remove Duplicates from Sorted LL.cpp:19
↓ 1 callers
Function
removeLoop
Time: O(N) Space: O(1)
11. Linked List/33 Detect and Remove Loop/33 Detect and Remove Loop.cpp:19
↓ 1 callers
Function
repeatingElement
06. Searching/16 Repeating Element/16e.cpp:4
↓ 1 callers
Function
repeatingElement
06. Searching/16 Repeating Element/16d.cpp:4
↓ 1 callers
Function
repeatingElement
super naive
06. Searching/16 Repeating Element/16a.cpp:13
↓ 1 callers
Function
repeatingElement
06. Searching/16 Repeating Element/16c.cpp:4
↓ 1 callers
Function
repeatingElement
06. Searching/16 Repeating Element/16b.cpp:4
↓ 1 callers
Function
reverse
Time: O(N) Space: O(N)
11. Linked List/28 Recursive Reverse of LL/28 Recursive Reverse of LL.cpp:19
↓ 1 callers
Function
reverse
Time: O(N) Space: O(1)
11. Linked List/14 Reverse Doubly LL/14 Reverse Doubly LL.cpp:21
↓ 1 callers
Function
reverse
11. Linked List/41 Palindrome Linked List/41 Palindrome Linked List.cpp:17
↓ 1 callers
Function
reverse
Time: O(N) Space: O(N)
11. Linked List/27 Iterative Reverse of LL/27a Iterative Reverse of LL.cpp:19
↓ 1 callers
Function
reverse
Time: O(N) Space: O(1)
11. Linked List/27 Iterative Reverse of LL/27b Iterative Reverse of LL.cpp:19
↓ 1 callers
Function
reverse
13. Queue/05_Reversing_Queue_Recursive.cpp:14
↓ 1 callers
Function
reverse
Time: O(n)
05. Arrays/07 Reverse Array/07 Reverse Array.cpp:5
↓ 1 callers
Function
reverseKgroup
Time: O(N) Space: O(N/K)
11. Linked List/30 Reverse LL in group size of K/30a Reverse LL in group size of K.cpp:19
↓ 1 callers
Function
reverseKgroup
Time: O(N) Space: O(N/K)
11. Linked List/30 Reverse LL in group size of K/30b Reverse LL in group size of K.cpp:19
↓ 1 callers
Function
reverseWords
10. Strings/13 Reverse Words in String/13b Reverse Words in String.cpp:17
↓ 1 callers
Function
reverseWords
10. Strings/13 Reverse Words in String/13a Reverse Words in String.cpp:7
↓ 1 callers
Function
rotate
10. Strings/14 Check Rotation/14a Check if Strings are Rotation.cpp:4
↓ 1 callers
Function
rotate
Time: O(n)
05. Arrays/10 Left Rotate Array by One/10 Left Rotate Array by One.cpp:5
↓ 1 callers
Function
rotate
08. Matrix/05 Rotate/05 Rotate.cpp:4
↓ 1 callers
Function
rotateDspaces
Time: O(n) Space: O(d)
05. Arrays/11 Left Rotate Array by D Spaces/11b Left Rotate Array by D Spaces.cpp:6
↓ 1 callers
Function
rotateDspaces
Time: O(n*d)
05. Arrays/11 Left Rotate Array by D Spaces/11a Left Rotate Array by D Spaces.cpp:5
↓ 1 callers
Function
rotateDspaces
Reversal Algorithm Time: O(n) Space: O(1)
05. Arrays/11 Left Rotate Array by D Spaces/11c Left Rotate Array by D Spaces.cpp:17
↓ 1 callers
Function
search
Time: O(N) Space: O(N)
11. Linked List/10 Recursive Search/10 Recursive Search.cpp:19
↓ 1 callers
Function
search
Time: O(N) Space: O(1)
11. Linked List/09 Iterative Search/09 Iterative Search.cpp:19
↓ 1 callers
Function
search
Iterative Implementation Time: O(logN) Space: O(1)
16. Binary Search Tree/01 Search in BST/01b Search in BST.cpp:22
↓ 1 callers
Function
search
Recursive Implementation Time: O(logN) Space: O(logN)
16. Binary Search Tree/01 Search in BST/01a Search in BST.cpp:22
↓ 1 callers
Function
search
08. Matrix/07 Search in Row and Column wise Sorted Matrix/07 Search in Row and Column wise Sorted Matrix.cpp:4
↓ 1 callers
Function
searchInfinite
unbounded binary search
06. Searching/07 Search in Infinite Sized Array/07b search in infinite sorted array.cpp:27
↓ 1 callers
Function
searchInfinite
06. Searching/07 Search in Infinite Sized Array/07a search in infinite sorted array.cpp:4
↓ 1 callers
Function
searchRotated
06. Searching/08 Search in Sorted Rotated Array/08b search in sorted rotated array.cpp:12
↓ 1 callers
Function
searchRotated
linear search
06. Searching/08 Search in Sorted Rotated Array/08a search in sorted rotated array.cpp:16
↓ 1 callers
Function
secondLargest
Time: O(n) (two traversals)
05. Arrays/05 Second Largest Element/05a Second Largest Element.cpp:19
↓ 1 callers
Function
secondLargest
Time: O(n) (one traversal)
05. Arrays/05 Second Largest Element/05b Second Largest Element.cpp:5
↓ 1 callers
Function
segregateEvenOdd
Time: O(N) Space: O(1)
11. Linked List/35 Seagregate Even Odd Nodes of LL/35 Segregate Even Odd Nodes of LL.cpp:19
↓ 1 callers
Function
selectionSort
time: O(n*n) space: O(1)
07. Sorting/04 Selection Sort/04 Selection Sort.cpp:16
↓ 1 callers
Function
serialize
Time: O(N) space: O(N)
15. Binary Tree/24 Serialize and Deserialize Binary Tree/24.cpp:26
↓ 1 callers
Function
setBits
03. Bit Manipulation/04 Power of Two/04a check power of two.cpp:4
↓ 1 callers
Function
setBits
Time: O(logn)
03. Bit Manipulation/03 Count Set Bits/03a count set bits.cpp:5
↓ 1 callers
Function
setBits
Time: O(k) ; k:total set bits
03. Bit Manipulation/03 Count Set Bits/03b count set bits.cpp:8
↓ 1 callers
Function
shortestPath
trick : use BFS as in BFS we go in shortest path manner
18. Graphs/06 Shortest Path in Unweighted Graph/06 Shortest Path in Unweighted Graph.cpp:5
↓ 1 callers
Function
size
Time: O(N) Space: O(W)
15. Binary Tree/11 Size of Binary Tree/11a.cpp:21
↓ 1 callers
Function
size
Time: O(N) Space: O(H);
15. Binary Tree/11 Size of Binary Tree/11b.cpp:21
↓ 1 callers
Function
solveMaze
20. Backtracking/02 Rat in a Maze/02 Rat in a Maze.cpp:24
↓ 1 callers
Function
solveMazeRec
20. Backtracking/02 Rat in a Maze/02 Rat in a Maze.cpp:40
← previous
next →
401–500 of 1,161, ranked by callers