memesearch

Thanos Sort Randomly Deletes Data

Download Find similar pictures
Text on the meme
Thanos Sort Checks if the array is sorted. If not, it randomly turns half of the elements to dust. Repeats until sorted. function thanosSort(arr) { function isSorted(arr) { for (let i = 0; i < arr.length - 1; i++) { if (arr[i] > arr[i + 1]) return false; } return true; } while (!isSorted(arr)) { const half = Math.floor(arr.length / 2); for (let i = 0; i < half; i++) { const p = Math.floor(Math.random() * arr.length); arr.splice(p, 1); } } return arr; }
What it means

На экране показана анимация алгоритма Thanos Sort: столбцы массива постепенно исчезают и превращаются в пыль, пока не остаются два элемента, которые затем подсвечиваются зелёным как отсортированный массив. Шутка в том, что алгоритм сортирует данные не сравнением, а случайным уничтожением половины элементов, как Танос уничтожает половину вселенной; фоновая музыка подчёркивает абсурдную драматичность процесса. EN: The screen shows an animation of the Thanos Sort algorithm: array bars gradually disappear and turn to dust until only two elements remain, which are then highlighted green as the sorted array. The joke is that the algorithm sorts data not by comparing values, but by randomly destroying half the elements, like Thanos destroying half the universe; the background music emphasizes the absurd drama of the process.

Sound
Who
Objects
Tags
Source
Template
Thanos Sort
Type
video, 0:08
Size
1014×1810 · 465.8 KiB
Mood
absurd, dramatic
Language
en
Added