All pastes #526097 Raw Edit

Untitled

public text v1 · immutable
#526097 ·published 2007-05-31 17:39 UTC
rendered paste body
void recurse(int n, int m, char* stack, filled = 0)
{
	if (filled = m)
	{
		display(stack, m);
		return
	}
	if (filled == 0)
	{
		for (int x = 0; x < n - (m - filled); ++x)
		{
			stack[0] = 'a' + x;
			recurse(n, m, stack, filled + 1);
		}
		return;
	}
	for (int x = stack[filled - 1] - 'a'; x < n - (m - filled); ++x)
	{
		stack[filled] = 'a' + x;
		recurse(n, m, stack, filled + 1);
	}
	return;
}

stack = new char[3];
recurse(5, 3, stack)