Puzzle 9: The Disorganized Handyman

preview_player
Показать описание
MIT 6.S095 Programming for the Puzzled, IAP 2018
Instructor: Srini Devadas

A disorganized handyman has mixed up his nuts and bolts in a bag and your task is to match them as quickly as possible. Curiously, as described in this video, a famous algorithm for sorting numbers, quicksort, provides an insight into solving this problem.

License: Creative Commons BY-NC-SA
Рекомендации по теме
Комментарии
Автор

This quicksort algorithm is amazing. It's in-place, requires only one external slot (for the pivot) and never does a swap. It just copies.

kenhaley