A binary tree with only one node has a height of 1. Questions: 1. At most how many and at least how many nodes can a binary tree of height 2016 have? Justify your answers. 2. Write a function Height(t) that, given a treet, returns its height. 3. Peter wants to check if a binary search treet is an AVL tree. Write a function ISAVL(t) that takes a binary search tree t as input and returns TRUE if the tree is an AVL tree (balanced) and FALSE otherwise.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question
A binary tree with only one node has a height of 1.
Questions:
1. At most how many and at least how many nodes can a binary tree of height 2016 have? Justify
your answers.
2. Write a function Height(t) that, given a treet, returns its height.
3. Peter wants to check if a binary search treet is an AVL tree. Write a function ISAVL(t) that
takes a binary search tree t as input and returns TRUE if the tree is an AVL tree (balanced) and
FALSE otherwise.
Transcribed Image Text:A binary tree with only one node has a height of 1. Questions: 1. At most how many and at least how many nodes can a binary tree of height 2016 have? Justify your answers. 2. Write a function Height(t) that, given a treet, returns its height. 3. Peter wants to check if a binary search treet is an AVL tree. Write a function ISAVL(t) that takes a binary search tree t as input and returns TRUE if the tree is an AVL tree (balanced) and FALSE otherwise.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning