diff options
Diffstat (limited to 'tree/src/tree.adb')
-rw-r--r-- | tree/src/tree.adb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tree/src/tree.adb b/tree/src/tree.adb new file mode 100644 index 0000000..7e4a897 --- /dev/null +++ b/tree/src/tree.adb | |||
@@ -0,0 +1,12 @@ | |||
1 | package body tree is | ||
2 | |||
3 | function Height (T : Tree_Access) return Integer is | ||
4 | begin | ||
5 | if T = null then | ||
6 | return 0; | ||
7 | else | ||
8 | return 1 + Integer'Max (Height (T.Left), Height (T.Right)); | ||
9 | end if; | ||
10 | end Height; | ||
11 | |||
12 | end tree; | ||