Frage im Vorstellungsgespräch bei Microsoft

(First Interview) Implement an TreeIterator class that implements an iterator interface

Antwort im Vorstellungsgespräch

Anonym

13. Aug. 2019

Used BFS to traverse the tree adding nodes to a queue. hasNext() checks that the queue is not empty, next() polls element from the queue, adds its children to the queue and returns the element