Question: // // Purpose: // // Return a list of all the key/value Entrys stored in the tree // The list will be constructed by performing
// // Purpose: // // Return a list of all the key/value Entrys stored in the tree // The list will be constructed by performing a level-order // traversal of the tree. // // Level order is most commonly implemented using a queue of nodes. // // From wikipedia (they call it breadth-first), the algorithm for level order is: // // levelorder() // q = empty queue // q.enqueue(root) // while not q.empty do // node := q.dequeue() // visit(node) // if node.left != null then // q.enqueue(node.left) // if node.right != null then // q.enqueue(node.right) // // Note that we will use the Java LinkedList as a Queue by using // only the removeFirst() and addLast() methods. // public List> entryList() { List> l = new LinkedList>();
return l;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
