From a3dd2581ed4847670f81157091016c14ca18803d Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Tue, 14 Jan 2020 18:29:11 +0700 Subject: [usth/MATH2.3] Mathemate Discretely --- usth/MATH2.3/3/README.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 usth/MATH2.3/3/README.md (limited to 'usth/MATH2.3/3/README.md') diff --git a/usth/MATH2.3/3/README.md b/usth/MATH2.3/3/README.md new file mode 100644 index 0000000..fed19eb --- /dev/null +++ b/usth/MATH2.3/3/README.md @@ -0,0 +1,76 @@ +# Trees +## Problem 1 +`graph-is-tree.cc` (C++17) take a natural numbers `n` and a `n`-by-`n` adjacent +matrix from stdin and print to stdout either yes or no depending on whether the +given graph is a tree or not, e.g. + +### Input + 3 + 0 1 0 + 1 0 1 + 0 1 0 + +### Output + yes + +## Problem 2 +`binary-search-tree.c` takes a natural number `n` and `n` integers from stdin +and print to stdout a horizontal binary search tree formed (naïvely) from the +given input, e.g. + +### Input + 7 + 34 45 21 65 12 546 23 + +### Output + 12 + 21 + 23 + 34 + 45 + 65 + 546 + +## Problem 3 +`dc.cc` takes from stdin a list of numbers and operator, each terminated by a +semi-colon and print to stdout the evaluation of the given postfix arithmetic +expression, e.g. + +### Input + 6.9;4.20;+;2;^;6.9;4;-;3;/;+; + +### Output + 124.177 + +## Problem 4 +`st-dfs.cc` (C++17) takes a natural number `n` and an `n`-by-`n` adjacent +matrix from stdin and print the edges on a spanning tree of the given graph to +stdout, e.g. + +### Input + 4 + 0 1 1 1 + 1 0 1 1 + 1 1 0 1 + 1 1 1 0 + +### Output + 2 3 + 0 3 + 1 2 + +## Problem 5 +`sum-set.cc` takes a natural number `n` and a line of positive integers on one +line from stdin and print numbers whose sum are `n`, separated by a newline, to +stdout, e.g. + +### Input + 7 + 1 2 3 4 5 6 7 8 9 + +### Output + 1 2 4 + 1 6 + 2 5 + 3 4 + 7 -- cgit 1.4.1