- Recursion
- Sorting
- Bubble sort
- Selection sort
- Insertion sort
- Efficient for (almost) sorted lists or small lists
- Merge sort
- Guaranteed time complexity -> O(nlog(n))
- Space complexity -> O(n)
- Quick sort
- Worst case time complexity -> O(n^2)
- Space complexity -> O(log(n))
- Additional:
- Radix sort
- Counting sort
- Potentially better time complexity ~ O(n+k) / O(nk)
- Only for numbers and in range
- Searching
- Breadth first search (BFS)
- Good for shortest path problems without weighting
- Required more memory
- Depth first search (DFS)
- Good for path existence problems
- Might be slow and consume memory to store call stack for tall tree
- Additional:
- Dijkstra Algorithm
- Good for shortest path problems on positive-weighted graphs
- Better efficiency compared to Bellman-Ford
- Bellman-Ford Algorithm
- Can handle negative-weighted graphs
- Worst case time complexity -> O(n^2)
- Dijkstra Algorithm
- Breadth first search (BFS)
- Dynamic Programming
- Cache calculated results
- Might bring time complexity of recursive functions from O(2^n) to O(n)
-
Notifications
You must be signed in to change notification settings - Fork 0
krissolui/algorithm-js
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Algorithms in JavaScript
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published