Intern Software Interview Questions

17,744 intern software interview questions shared by candidates

Given the root node of a tree, write two Java programs to visit all nodes of the tree, one in a depth-first fashion and the other in a breadth-first fashion, both without using recursion. Assume a node is represented by a class named Node, which has a method children() that returns a list of child nodes. Call node.visit() to visit a node.
avatar

Software Engineer Intern

Interviewed at Motorola Mobility

4.2
Mar 19, 2009

Given the root node of a tree, write two Java programs to visit all nodes of the tree, one in a depth-first fashion and the other in a breadth-first fashion, both without using recursion. Assume a node is represented by a class named Node, which has a method children() that returns a list of child nodes. Call node.visit() to visit a node.

Viewing 691 - 700 interview questions

Glassdoor has 17,744 interview questions and reports from Intern software interviews. Prepare for your interview. Get hired. Love your job.