about summary refs log tree commit diff
path: root/usth/MATH2.3/3/README.md
diff options
context:
space:
mode:
authorNguyễn Gia Phong <vn.mcsinyx@gmail.com>2020-01-14 18:29:11 +0700
committerNguyễn Gia Phong <vn.mcsinyx@gmail.com>2020-01-14 18:29:11 +0700
commita3dd2581ed4847670f81157091016c14ca18803d (patch)
tree3362ab15de119f1e75799f58715b7683e6bfd6ca /usth/MATH2.3/3/README.md
parent65b8ebda4c47fa27ac28899fb2b29097f445b6df (diff)
downloadcp-a3dd2581ed4847670f81157091016c14ca18803d.tar.gz
[usth/MATH2.3] Mathemate Discretely
Diffstat (limited to 'usth/MATH2.3/3/README.md')
-rw-r--r--usth/MATH2.3/3/README.md76
1 files changed, 76 insertions, 0 deletions
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