Website Summary Files Commits Branches @commit @diff @stats
path: root / Seminar08 / height.cpp
diff options
context:
space:
mode:
Commit12e79fb23f045782daf180d229ca496ca798dfb9 (patch)
Author
 Димитър Цонев <56803540+mitko430@users.noreply.github.com>
2022-11-30 20:20:04 +0200
Committer
 GitHub <noreply@github.com>
2022-11-30 20:20:04 +0200
Files6fb96c092ef3e53aeff0d9fc93a1cb5d6086c038 /Seminar08/height.cpp
Data-structures-and-algorithms-12e79fb23f045782daf180d229ca496ca798dfb9.tar
Data-structures-and-algorithms-12e79fb23f045782daf180d229ca496ca798dfb9.tar.gz
Data-structures-and-algorithms-12e79fb23f045782daf180d229ca496ca798dfb9.zip
Parentc5eba3a40b563a9bb91e7e061934d3585c6be5b6 (diff)
Create height.cpp
1 files changed, 14 insertions, 0 deletions
-rw-r--r--Seminar08/height.cpp14
diff --git a/Seminar08/height.cpp b/Seminar08/height.cpp
new file mode 100644
index 0000000..97ba9ab
--- /dev/null
+++ b/Seminar08/height.cpp
@@ -0,0 +1,14 @@
+#include"tree-utils.h"
+#include<iostream>
+
+template<typename T>
+size_t height(const Tree<T>* tree) {
+ if (!tree)
+ return 0;
+
+ return 1 + std::max(heightOfTree(tree->left), heightOfTree(tree->right));
+}
+
+int main(){
+
+}