Skip to content

Instantly share code, notes, and snippets.

@bit-hack
bit-hack / heap.cpp
Last active January 5, 2019 23:19
Generate all possible permutations of n objects.
// non-recursive version of algorythm presented here:
// http://ruslanledesma.com/2016/06/17/why-does-heap-work.html
#include <algorithm>
#include <array>
#include <stddef.h>
#include <stdio.h>
#include <vector>
template <typename type_t>