CSE 2331 Lecture 17: Lecture 17

11 views5 pages

Document Summary

Bst if x then else search lpointes x to a node integer k. K l x key then in a return return searchcx left k search x right by else iterative psoe search 2 x b while x if. Running time depends on heightof the tree gli of. If defir graph then diam g max dist. U i w e v v w where dist lv w min lengthcp. P is a path btw v and w. Problem given a pointer r root of a binary tree t compute diam t to the. 2 height right night left where the height of the empty tree defined to be. 17 prod height anddiameter pointer x returns integers height diameter. The pointer x points to a node in a binary tree return the height tree diameter of the rooted at xu the and. X n 1l then return c ii 0.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents