From 12e79fb23f045782daf180d229ca496ca798dfb9 Mon Sep 17 00:00:00 2001 From: Димитър Цонев <56803540+mitko430@users.noreply.github.com> Date: Wed, 30 Nov 2022 20:20:04 +0200 Subject: Create height.cpp --- Seminar08/height.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Seminar08/height.cpp (limited to 'Seminar08/height.cpp') 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 + +template +size_t height(const Tree* tree) { + if (!tree) + return 0; + + return 1 + std::max(heightOfTree(tree->left), heightOfTree(tree->right)); +} + +int main(){ + +} -- cgit v1.3.1-23-gd82d