Sort 200 different colors in under 30 seconds #shorts
Quick sort and Merge sort are used. We see that quicksort takes fewer operations here, but some of that could be how I counted the operations. Quicksort is known for being the fastest though.
Quicksort work by selecting a pivot value and putting everything less than (or equal to) that pivot to the left of it in the array, and everything greater than the pivot to the right of it.
Merge sort works by recursively splitting the list until it has two lists with only one element in them, and then merging them together in the correct order.
Both of these are n log n time. My quicksort implementation doesn't use extra storage, my merge sort implementation does make slices of the list when it is splitting.
This was done using python & pygame
All code
Copyright 2021 Google LLC
SPDX-License-Identifier: Apache-2.0
https://www.apache.org/licenses/LICEN...
The inspiration for this code was this github repo
https://github.com/LucasPilla/Sorting...
I used this algorithm to turn a wavelength into an RGB color
http://www.noah.org/wiki/Wavelength_t...
Thumbnail Background image (Thunderstorm) by FelixMittermeier
https://pixabay.com/photos/thundersto...
Watch video Quicksort vs Mergesort in 35 Seconds online without registration, duration hours minute second in high quality. This video was added by user Dubious Code 30 January 2021, don't forget to share it with your friends and acquaintances, it has been viewed on our site 247,16 once and liked it 13 thousand people.