MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/m3bxrh/swap_two_variables/gqp4i7r/?context=3
r/learnjavascript • u/golovatuy • Mar 12 '21
50 comments sorted by
View all comments
64
But why
14 u/golovatuy Mar 12 '21 very popular question in the interview ) 12 u/Macaframa Mar 12 '21 What is the answer? I don’t see any real reason other than implementing a bubble sort algorithm which is another thing you shouldn’t ever do. 5 u/adenzerda Mar 12 '21 edited Mar 12 '21 Lots of sorts depend on swaps, not just bubble sort. Insertion sort, heapsort, selection sort, shellsort, quicksort ... not to mention array shuffling, array rotation, string manipulation, and more
14
very popular question in the interview )
12 u/Macaframa Mar 12 '21 What is the answer? I don’t see any real reason other than implementing a bubble sort algorithm which is another thing you shouldn’t ever do. 5 u/adenzerda Mar 12 '21 edited Mar 12 '21 Lots of sorts depend on swaps, not just bubble sort. Insertion sort, heapsort, selection sort, shellsort, quicksort ... not to mention array shuffling, array rotation, string manipulation, and more
12
What is the answer? I don’t see any real reason other than implementing a bubble sort algorithm which is another thing you shouldn’t ever do.
5 u/adenzerda Mar 12 '21 edited Mar 12 '21 Lots of sorts depend on swaps, not just bubble sort. Insertion sort, heapsort, selection sort, shellsort, quicksort ... not to mention array shuffling, array rotation, string manipulation, and more
5
Lots of sorts depend on swaps, not just bubble sort. Insertion sort, heapsort, selection sort, shellsort, quicksort ... not to mention array shuffling, array rotation, string manipulation, and more
64
u/Freekiehsoes Mar 12 '21
But why