Question: The group exercise has finished, but i don't know how to finish the delete part. Thank you. the delete part. Thank you Possible Solution Find
The group exercise has finished, but i don't know how to finish the delete part. Thank you.


the delete part. Thank you
Possible Solution Find public boolean find(int k) { return find(root, k) != null; } private Node find(Node n, int k) { if (n == null) return n; public boolean find2(int k) { Node c = root; while (c != null) { if (c.key > k) C = c.left; else if (c.key k) return find(n.left, k); else if (n.key k) C = c.left; else if (c.key k) { if (p.left == null) { p.left = n; break; } else p = p.left; } else { if (p.right == null) { p.right = n; break; } else p = p.right; Activa return false; } } Go to se public int findMin() { if (root == null) throw new RuntimeException("The tree is empty!"); Node n = root; while(n.left != null) n = n.left; return n.key; Possible Solution Find Min & Find Max public int findMax() { if (root == null) throw new RuntimeException("The tree is empty!"); 50 23 64 Node n = root; while(n.right != null) n = n.right; return n.key; 10 43 55 78 } Min Max 36 Activate wi Go to Settings Possible Solution Print public void print() { print(root); System.out.println(); } private void print(Node n) { if (n == null) return; print(n.left); System.out.print(n.key + print(n.right); ")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
