About 50 results
Open links in new tab
  1. Traversing through all nodes of a binary tree in Java

    Mar 9, 2013 · Traversing through all nodes of a binary tree in Java Asked 12 years, 11 months ago Modified 11 years, 11 months ago Viewed 83k times

  2. java - How to implement in-order, pre-order and post-order traversals ...

    Sep 8, 2016 · Here the class tree_orders (sic.) is run in a Thread with a stack size of 1 << 23. This stack size is a hint to the Java runtime to limit the memory needed to keep track of nested method calls to …

  3. java - How do implement a breadth first traversal? - Stack Overflow

    Oct 6, 2016 · Breadth first is a queue, depth first is a stack. For breadth first, add all children to the queue, then pull the head and do a breadth first search on it, using the same queue. For depth first, …

  4. java - Traversing a Binary Tree Recursively - Stack Overflow

    In-order traversal (LVR) Reverse order traversal (RVL) Preorder traversal (VLR) Postorder traversal (LRV) Your code appears to be performing the postorder traversal method, but you're getting a few …

  5. Java : binary tree + preorder traversal + recursion + return a result ...

    Aug 23, 2022 · Small Java question on a preorder traversal of a binary tree, using recursion, with a result list of all the elements returned please. Looking at the web we can see many result on the use …

  6. java - How to implement Pre-order Tree traversal using recursion ...

    Jun 24, 2022 · I am having trouble implementing traversals in a tree. The assignment explicitly states that the pre-order traversal must be done recursively. In addition, the traversal method MUST also …

  7. java - Traversing a tree recursively in depth first problems - Stack ...

    Mar 15, 2012 · I'm trying to traverse a tree using ANTLR tree commands and recursion. The code I currently have is: public void traverseTree(Tree tree){ int counter = 0; System.out.println(tree.

  8. Tree traversal in Java - Stack Overflow

    Jan 27, 2013 · Write a function that returns a node in a tree given two parameters: pointer to the root node and the inorder traversal number of the node we want to return. The only information stored in …

  9. java - Write a non-recursive traversal of a Binary Search Tree using ...

    Nov 30, 2014 · Write a non-recursive traversal of a Binary Search Tree using constant space and O (n) run time Asked 14 years, 10 months ago Modified 9 years, 11 months ago Viewed 43k times

  10. java - Preorder Binary Tree Traversal - Stack Overflow

    Nov 25, 2020 · Preorder binary tree traversal algorithm: Visit the root. Traverse the left subtree, i.e., call Preorder (left-subtree) Traverse the right subtree, i.e., call Preorder (right-subtree); Thus, first you …