# Questions tagged [tree-traversal]

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

**0**

votes

**1**answer

53 views

### Binary tree level order traversal using double pointer

Creating binary tree doesn't matter. I can see printed result of LevelOrder but it keeps put up a error. How can I fix changes while minimizing them? I need to be hurry :(I think print DELETE() is ...

**0**

votes

**0**answers

18 views

### BTree - Traverse only PART of tree (Python 3)

Summary: I know how to build a Binary Tree in Python. I know how to traverse it. I even know how to search for specific values in that BTree; however, I can't figure out how to traverse only part of a ...

**3**

votes

**1**answer

54 views

### Vertical Order Traversal in using Level Order Concept of Binary Tree

I want to traverse a Binary Tree vertically. And I found a working code in Geeks for Geeks in C++. I want to convert it into C# but I am unable to do so. Please guide me. Below is my attempt:// we ...

**0**

votes

**0**answers

23 views

### BST pre order traversal to in order traversal

I have been trying to implement an in order traversal of a tree, however, I want to do it using a queue (my code tries to find the kth largest element in a tree, im using a queue and stack to do this)...

**0**

votes

**2**answers

38 views

### Is it possible to print each level of a binary tree on a separate line using depth-first traversal?

I am familiar with the use of a queue to print each level in a separate line in O(n) time. I want to know if there is any way to do this using pre-order, in-order or post-order traversal. I have ...

**1**

vote

**0**answers

16 views

### construction of bst from preorder traversal

While constructing Binary search tree from given Preorder traversal, can't we use normal method for construction of BST from set of array values instead of following the method given here. If not ,...

**1**

vote

**1**answer

27 views

### ZigZag binary tree traversal in C++

I am trying to attempt zig zag traversal of binary tree. But I am stuck at one type of test cases, i.e., when the tree is not balanced. If I give my input as 33 9 20 null null 15 7for a binary ...

**0**

votes

**1**answer

31 views

### View of a binary tree from 45 degree

So I am not asking diagonal view of a tree, which fortunately I already know. I am asking if I view a tree from 45-degree angle only a few nodes should be visible. So there is a plane which at an ...

**1**

vote

**2**answers

62 views

### I need an algorithm to walk a tree with optional and alternative nodes to calculate all possible paths

Given the following tree which is a sort of Backus-Nauf form like notation where| indicates or (so B is F or G) and [] indicate optional (so H is optional)Def: A B CA: D EB: F | GC: [H] ID: a b...

**0**

votes

**1**answer

22 views

### Found a bug, fixed it , I dont understand why it was bugging?

I've come across a bug that has now been fixed but I still dont understand the underlying cause for it.What I would like to do:Use post-order tree traversal to get postfix expression from a binary ...

**0**

votes

**1**answer

10 views

### Traversal String Representation

I am working on a in-order traversal and I am having difficulty creating a recursive in-order tree traversal in which a string is being made to look like this [ 1, 2, 3 ]. Instead I get something like ...

**0**

votes

**0**answers

27 views

### Counting maximum number of node traversal in a tree

I have a tree with N nodes.k paths are given in the form of u,v.Now, the problem is to find the the maximum number of times a tree node is traversed while going from u to v (not to find the node ...

**3**

votes

**1**answer

86 views

### Count number of nodes per level in a binary tree

I've been searching for a bit now and haven't been able to find anything similar to my question. Maybe i'm just not searching correctly. Anyways this is a question from my exam review. Given a binary ...

**1**

vote

**1**answer

25 views

### Find element that has no direct children with specific class

In a page of HTML elements, I am trying to find a parent element with class .dmc that does not contain a direct child element with a specific class .dynamic, using JQuery.I have tried:$('.dmc:not(:...

**0**

votes

**1**answer

22 views

### StackOverflow exception in findPath method

I am trying to build the path for value in huffman, but I am getting stackoverflow exception.My code:public String findPath(short target, int root, String path){String result;if (root &...