![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 10.03.2020 01:33 ctyrector
Procedure TreeSearch (x, K) i if (x = NIL) or (K = x. key) then 2 return (x); 3 else if (K < x. key) then 4 | TreeSearch (x. left, K); 5 else 6 TreeSearch (x. right, K); 7 endConsider a binary search tree where each tree node v has a field v. sum which stores the sum of all the keys in the subtree rooted at v.
We wish to add an operation SumLE(K) to this binary search tree which returns the sum of all the keys in the tree whose values are less than or equal to K.
(a) Describe an algorithm, SumLE(K), which returns the sum of all the keys in the tree whose values are less than or equal to K. Give pseudo-code for your algorithm. Your algorithm should take the same time as operation TreeSearch from slide 7.12.
(b) Explain why your algorithm is correct, i. e., why it returns the sum of all the keys whose values are less than or equal to K.
(c) Analyze the running time of your algorithm in terms of the size n and height h of the binary search tree.
![ansver](/tpl/images/cats/User.png)
Answers: 3
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 17:00
Your company has 1,500 desktop computers running windows 7. you want to upgrade them to windows 10. which type of microsoft license would be best suited in this situation?
Answers: 3
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 11:30
The most accurate readings that you can take on an analog vom are when the meter's pointer is at the a. center scale. b. extreme right. c. near right. d. extreme left.
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 20:00
What software programs are used to to create professional publication? a.) graphics programs b.) word processors c.) page layout programs d.) spreadsheet programs
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 22:20
If i uninstall nba 2k 19 from my ps4 will my career be gone forever?
Answers: 2
You know the right answer?
Procedure TreeSearch (x, K) i if (x = NIL) or (K = x. key) then 2 return (x); 3 else if (K < x. k...
Questions
![question](/tpl/images/cats/fizika.png)
Physics, 18.12.2020 01:30
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/en.png)
English, 18.12.2020 01:30
![question](/tpl/images/cats/mat.png)
Mathematics, 18.12.2020 01:30
![question](/tpl/images/cats/biologiya.png)
Biology, 18.12.2020 01:30
![question](/tpl/images/cats/en.png)
English, 18.12.2020 01:30
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 18.12.2020 01:30
![question](/tpl/images/cats/en.png)
English, 18.12.2020 01:30
![question](/tpl/images/cats/mir.png)
World Languages, 18.12.2020 01:30
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 18.12.2020 01:30
![question](/tpl/images/cats/biologiya.png)
![question](/tpl/images/cats/en.png)
English, 18.12.2020 01:30
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 18.12.2020 01:30
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 18.12.2020 01:30
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 18.12.2020 01:30
![question](/tpl/images/cats/mat.png)
Mathematics, 18.12.2020 01:30