All pastes #526084 Raw Edit

Untitled

public text v1 · immutable
#526084 ·published 2007-05-31 17:28 UTC
rendered paste body

void recurse(a, b, stack, filled = 0)
{
	if (b == filled)
	{
		display(stack, b);
		return
	}
	if (!filled)
	{
		for (int x = 0; x < a - (b - filled); ++x)
		{
			stack[0] = 'a' + x;
			recurse(a, b, stack, filled + 1);
		}
		return;
	}
	for (int x = stack[filled - 1] - 'a'; x < a - (b - filled); ++x)
	{
		stack[filled] = 'a' + x;
		recurse(a, b, stack, filled + 1);
	}
	return;
}

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