Top "Tree-traversal" questions

The process of visiting each node in a tree based on certain criterion.

Write a non-recursive traversal of a Binary Search Tree using constant space and O(n) run time

This is not homework, this is an interview question. The catch here is that the algorithm should be constant space. …

java binary-tree traversal tree-traversal
What is the time complexity of tree traversal?

What is the time complexity of tree traversal, I'm sure it must be obvious but my poor brain can not …

tree time-complexity tree-traversal
Level Order Traversal of a Binary Tree

void traverse(Node* root) { queue<Node*> q; Node* temp_node= root; while(temp_node) { cout<<temp_…

c++ algorithm binary-tree breadth-first-search tree-traversal
Traversing a n-ary tree without using recurrsion

How can I traverse an n-ary tree without using recursion? Recursive way: traverse(Node node) { if(node == null) return; for(…

algorithm tree-traversal
Help me understand Inorder Traversal without using recursion

I am able to understand preorder traversal without using recursion, but I'm having a hard time with inorder traversal. I …

python algorithm tree tree-traversal non-recursive
jQuery: If the selected element $(this) has a parent with a classname of 'last'

I must be missing something quite important, I have been using .parent().parent().parent().. etc to traverse down the DOM …

jquery dom traversal tree-traversal
converting a binary search tree to doubly linked list

This question was asked in a recent coding interview. Q : Given a binary tree, write a program to convert it …

binary-search-tree tree-traversal doubly-linked-list
How to do in-order traversal of a BST without recursion or stack but using parent pointers?

Is it possible to do an iterative in-order-traversal on a BST whose node has a parent pointer (the parent of …

algorithm binary-search-tree tree-traversal iteration inorder
Fixing my implementation of "inorder tree traversal" algorithm with a Stack

Part of it is that I have to implement a non-recursive method of a inorder traversal of a binary tree. …

java tree stack binary-tree tree-traversal
cannot cast to java.lang.Comparable

Although this question has already been asked but I have an implementation specific doubt. I am trying to print the …

java binary-tree classcastexception tree-traversal