Kursova

Check-in [ede199dcd5]
Login

Check-in [ede199dcd5]

Overview
Comment:Fixed whitespace
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ede199dcd528c9253b9c1307ec877ebca123ce28a2b6021a41fbf0a158c0638a
User & Date: 4l1v3b33f on 2021-01-12 11:11:54.514
Other Links: manifest | tags
Context
2021-01-12
11:16
Added .clang-format and formatted sources according to it Leaf check-in: 69fc6d77ae user: 4l1v3b33f tags: trunk
11:11
Fixed whitespace check-in: ede199dcd5 user: 4l1v3b33f tags: trunk
10:57
MVP check-in: 65e10b5e58 user: 4l1v3b33f tags: trunk
Changes
︙︙
12
13
14
15
16
17
18

19
20
21
22

23

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42

43
44
45
46
47
48
49

using std::cin, std::cout, std::endl, std::flush, std::setw;
using std::stack, std::tuple;

void f_rec(const size_t fun_count, const size_t max_recursion_depth, const size_t n = 1, const size_t depth = 0)
{
	cout << setw(depth) << "" << n << endl;

	if (depth >= max_recursion_depth)
		return;

	for (size_t i = 0; i < fun_count - 1; i++)

		f_rec(fun_count, max_recursion_depth, (n + i) % fun_count + 1, depth + 1);

}

void f_iter(const size_t fun_count, const size_t max_recursion_depth)
{
	using stack_item = tuple<size_t, size_t>;

	stack<stack_item> return_stack;
	return_stack.push({1, 0});

	while (!return_stack.empty())
	{
		auto [n, depth] = return_stack.top();
		return_stack.pop();

		stack<stack_item> queue;

		// BEGIN unmodified code
		cout
			<< setw(depth) << "" << n << endl;

		if (depth >= max_recursion_depth)
			continue;

		for (size_t i = 0; i < fun_count - 1; i++)
		{
			queue.push({(n + i) % fun_count + 1, depth + 1});
		}







>




>

>

















<
|
>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

44
45
46
47
48
49
50
51
52

using std::cin, std::cout, std::endl, std::flush, std::setw;
using std::stack, std::tuple;

void f_rec(const size_t fun_count, const size_t max_recursion_depth, const size_t n = 1, const size_t depth = 0)
{
	cout << setw(depth) << "" << n << endl;

	if (depth >= max_recursion_depth)
		return;

	for (size_t i = 0; i < fun_count - 1; i++)
	{
		f_rec(fun_count, max_recursion_depth, (n + i) % fun_count + 1, depth + 1);
	}
}

void f_iter(const size_t fun_count, const size_t max_recursion_depth)
{
	using stack_item = tuple<size_t, size_t>;

	stack<stack_item> return_stack;
	return_stack.push({1, 0});

	while (!return_stack.empty())
	{
		auto [n, depth] = return_stack.top();
		return_stack.pop();

		stack<stack_item> queue;

		// BEGIN unmodified code

		cout << setw(depth) << "" << n << endl;

		if (depth >= max_recursion_depth)
			continue;

		for (size_t i = 0; i < fun_count - 1; i++)
		{
			queue.push({(n + i) % fun_count + 1, depth + 1});
		}
︙︙