Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 45s1 days 16 hours 1 minutes 45 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 45s1 days 16 hours 1 minutes 45 seconds.

Sign in to watch this lesson
Advanced - Combinatorics, Games and Puzzles · 4:52
Two ways to list every K-subset of N items. The dictionary order steps from one combination to the next by bumping the rightmost slot that is still below its ceiling and refilling everything after it, while the revolving-door order, read off the Gray codes with exactly K ones, changes one member at a time. We see why the reflection behind the Gray code keeps every step to a single swap, build that order directly with a recursion instead of filtering 2^N codes, and time both on a Mac.