This is my code. I got error messege from the test. @Test ( timeout = TIMEOUT.)
ID: 3888591 • Letter: T
Question
This is my code.
I got error messege from the test.
@Test ( timeout = TIMEOUT.) public void testLeavesDescending) LinkedListExplanation / Answer
public List listLeavesDescending() { List list = new ArrayList(); Queue> queue = new LinkedList>(); BSTNode tmp = root; if (root == null) { return list; } else { queue.add(root); listLeavesDescendingHelper(list, queue, tmp); return list; } } private void listLeavesDescendingHelper(List list, Queue> queue, BSTNode node) { if (queue.isEmpty()) { return; } while (queue.size() > 0) { BSTNode tmp = queue.poll(); if (tmp.getLeft() != null && tmp.getRight() != null) { list.add(node.getData()); } if (tmp.getLeft() != null) { queue.add(tmp.getLeft()); } if (tmp.getRight() != null) { queue.add(tmp.getRight()); } } }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.