Skip to content

Commit 6b3daf1

Browse files
Added sorting use case exercise
1 parent 633b210 commit 6b3daf1

File tree

4 files changed

+51
-10
lines changed

4 files changed

+51
-10
lines changed

Algorithms/README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- [ ] Dynamic Programming
66
- [X] Comparison Sorting
77
- [X] *Merge Sort*
8-
- [X] *Quick Sort*
8+
- [X] *Quicksort*
99
- [X] Bubble Sort
1010
- [X] Selection Sort
1111
- [X] Insertion Sort
@@ -17,14 +17,25 @@
1717

1818
## Resources
1919
- [Visualizing Data Structures & Algorithms](https://visualgo.net/en)
20-
- [Unicode Characters: RapidTables](https://www.rapidtables.com/code/text/unicode-characters.html)
20+
- [Unicode Characters | RapidTables](https://www.rapidtables.com/code/text/unicode-characters.html)
2121
- [The Big-O Algorithm Complexity Cheat Sheet](https://www.bigocheatsheet.com/ "Big O Cheat Sheet")
2222

2323
### Sorting
2424
- [Array.prototype.sort()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)
25-
- [Animated Sorting: Toptal](https://www.toptal.com/developers/sorting-algorithms)
26-
- [Dancing Algorithms: AlgoRythmics](https://www.youtube.com/user/AlgoRythmics/videos)
27-
- [Importance of Stability in Sorting](https://stackoverflow.com/questions/1517793/what-is-stability-in-sorting-algorithms-and-why-is-it-important)
25+
- [Animated Sorting | Toptal](https://www.toptal.com/developers/sorting-algorithms)
26+
- [Dancing Algorithms | AlgoRythmics](https://www.youtube.com/user/AlgoRythmics/videos)what-is-stability-in-sorting-algorithms-and-why-is-it-important)
27+
- [QuickSort vs Heapsort](https://stackoverflow.com/questions/2467751/quicksort-vs-heapsort)
28+
- [Importance of Stability in Sorting](https://stackoverflow.com/questions/1517793/)
29+
30+
### Most Common Sorts
31+
- [Merge Sort | Brilliant.org](https://brilliant.org/wiki/merge/)
32+
- [Quicksort | Brilliant.org](https://brilliant.org/wiki/quick-sort/)
33+
- [Heap Sort | Brilliant.org](https://brilliant.org/wiki/heap-sort/)
34+
- [Radix Sort | Brilliant.org](https://brilliant.org/wiki/radix-sort/ "Non-Comparison Sort")
35+
- [Radix Sort Visualization](https://www.cs.usfca.edu/~galles/visualization/RadixSort.html)
36+
- [Counting Sort | Brilliant.org](https://brilliant.org/wiki/counting-sort/ "Non-Comparison Sort")
37+
- [Counting Sort Visualization](https://www.cs.usfca.edu/~galles/visualization/CountingSort.html)
2838

2939
### Recursion
30-
- [Tail Call Optimization: ES6](https://2ality.com/2015/06/tail-call-optimization.html)
40+
- [Recursion | Brilliant.org](https://brilliant.org/wiki/recursion-problem-solving/)
41+
- [Tail Call Optimization in ES6](https://2ality.com/2015/06/tail-call-optimization.html)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Sorting Use Cases
2+
3+
## Which sorting algorithm would be a good candidate for each situation?
4+
5+
1) Sort 10 schools around your house by distance.
6+
7+
2) eBay sorts listings by the current Bid amount.
8+
9+
3) Sport scores on ESPN.
10+
11+
4) Massive database (can't fit all into memory) needs to sort through past year's user data.
12+
13+
5) Almost sorted Udemy review data needs to update and add 2 new reviews.
14+
15+
6) Temperature Records for the past 50 years in Canada.
16+
17+
7) Large user name database needs to be sorted. Data is very random.
18+
19+
8) You want to teach sorting for the first time.
20+
21+
22+
## Potential Candidates
23+
1) Insertion Sort
24+
2) Radix/Counting Sort
25+
3) Quicksort
26+
4) Merge Sort
27+
5) Insertion Sort
28+
6) Radix/Counting Sort or Quicksort
29+
7) Mergesort/Quicksort
30+
8) Bubble Sort, Selection Sort

Playground/Demos/Objects_101.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ console.log(episode1);
1717
console.log('------------------------- Episode 2 -------------------------');
1818
const episode2 = Object.create(episode1);
1919

20-
console.log(episode2); // While fields don't show on console
21-
console.log(episode2.name, '—', episode2['characters']); // They are still populated by passed in prototype
22-
console.log(episode2.introduction()); // Function also exists because episode1 used as prototype
20+
console.log(episode2); // While fields don't show on console,
21+
console.log(episode2.name, '—', episode2['characters']); // they are still populated by passed in prototype.
22+
console.log(episode2.introduction()); // Function also exists because episode1 used as prototype.
2323

2424
episode2.name = 'The Avatar Returns';
2525
episode2['location'] = ['Southern Water Tribe', "Zuko's Ship"]; // Recommended assignment syntax

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
- [ ] Dynamic Programming
2222
- [X] Comparison Sorting
2323
- [X] *Merge Sort*
24-
- [X] *Quick Sort*
24+
- [X] *Quicksort*
2525
- [ ] Searching
2626
- [ ] Linear Search
2727
- [ ] Binary Search

0 commit comments

Comments
 (0)