only do if u can do all questions please

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

only do if u can do all questions please

Post by answerhappygod »

only do if u can do all questions please
Only Do If U Can Do All Questions Please 1
Only Do If U Can Do All Questions Please 1 (15.43 KiB) Viewed 35 times
Only Do If U Can Do All Questions Please 2
Only Do If U Can Do All Questions Please 2 (23.91 KiB) Viewed 35 times
40 78 10 SO 93 17 30 38 Figure 2. A Tree

10. Assume the tree on Figure 2 is a BST and we want to search for number "g" in it. What is the output of int Tree.search(8)? Trace the code below. You can draft a tree in the empty square below and visually explain your answer using this tree (how the search worked) step by step. Output: (3 points) goverride /** Returns true if the element is in the tree / public boolean search(e){ Treehode<E> current - roots / Start from the root while (current le null) { if (e.compare(e, current.element) < 0) { current current.left; 2 else if (c.compare(e, current.element) > e) { current - current.right; > else // element matches current.element return true; // Element is found > return false;
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply