QuickSort vs MergeSort: Which Sorts Colors Faster in 35 Seconds? ⚡

Watch a quick comparison of QuickSort and MergeSort as they sort 200 colors in under 30 seconds. Discover which algorithm performs better in this fast-paced showdown!

QuickSort vs MergeSort: Which Sorts Colors Faster in 35 Seconds? ⚡
Dubious Code
855.6K views • Jan 31, 2021
QuickSort vs MergeSort: Which Sorts Colors Faster in 35 Seconds? ⚡

About this video

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/LICENSE-2.0

The inspiration for this code was this github repo
https://github.com/LucasPilla/Sorting-Algorithms-Visualizer


I used this algorithm to turn a wavelength into an RGB color
http://www.noah.org/wiki/Wavelength_to_RGB_in_Python


Thumbnail Background image (Thunderstorm) by FelixMittermeier
https://pixabay.com/photos/thunderstorm-lightning-flashes-3625405/

Tags and Topics

Browse our collection to discover more content in these categories.

Video Information

Views

855.6K

Likes

36.1K

Duration

0:40

Published

Jan 31, 2021

User Reviews

4.8
(171)
Rate:

Related Trending Topics

LIVE TRENDS

Related trending topics. Click any trend to explore more videos.