Questions tagged [tree-traversal]

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

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

Use this tag for programming questions related to traversal of all types of trees.

See also:

832 questions
0
votes
1 answer

How to traverse DOM elements with jquery?

I'm still getting to grips with javascript, and am having trouble working out the correct syntax to select a DOM element. Would appreciate any points. The html:
0
votes
2 answers

Inorder starts from the "leftmost left node" so why doesn't Preorder start from "leftmost middle node"?

Consider this tree: 7 / \ / \ / \ 1 9 / \ / \ 0 3 8 10 / \ 2 5 / \ 4 6 Inorder: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,…
0
votes
3 answers

Post Order Traversal Formula

I am given 2 y 5 1 4 3 - * - * +, and am asked to evaluate it, and then draw the equivalent expression tree. I haven't done any work with this before, can someone show the steps you would take to solve this type of question? I have looked at: Post…
Matthew Brzezinski
  • 1,685
  • 4
  • 29
  • 53
0
votes
4 answers

How do I represent binary numbers in C++ (used for Huffman encoder)?

I am writing my own Huffman encoder, and so far I have created the Huffman tree by using a minHeap to pop off the two lowest frequency nodes and make a node that links to them and then pushing the new node back one (lather, rinse, repeat until only…
0
votes
6 answers

Binary Tree Nodes - Which Way?

For an assignment we were given in Data Structures, we had to create a test class to determine whether the code we were given correctly traversed the binary trees in our test class. These are the 3 constructors for BinaryTreeNode class that was…
StormFoo
  • 1,129
  • 2
  • 10
  • 25
0
votes
0 answers

How to recursively traverse root directory

I'm writing pure C application which should be able to traverse some directory recursively. When I set / as this directory and application starts at some time I get fails of lstat() - I get list of nodes in directory and later when I'm doing lstat()…
likern
  • 3,744
  • 5
  • 36
  • 47
0
votes
0 answers

Validating components in an object tree (traversing from the leaf)

For context on this question; we have the following data structure constructed (example) Book - Table of Contents - Chapter - Chapter Title - Pages - Paragraphs - Page Number This structure is constructed using…
csdev86
  • 83
  • 1
  • 1
  • 5
0
votes
1 answer

does creating order of adjacency list affect the searching performance?

I'm working on graphs and traversal techniques. However, i have a question about adjacency list. As you know in adjacency method you declare an array or a list for each vertex which keeps adjacent vertexes. So my question is "does adding order of…
0
votes
2 answers

Problems in binary tree traversal

I am trying to implement a binary search tree with In order traversal. I am trying to print a series of numbers after each other to test it. It seems that it is sorting well, however it is printing dublicate numbers sometimes. Look at relevant…
0
votes
1 answer

return current node from BST

Hello I've run into an issues I cannot seem to resolve. I have a BST that I am traversing through and checking ranks. I have a method checkRank(link head, targRank) that takes in the head node and traverses through the tree until it finds a node…
bardockyo
  • 1,415
  • 6
  • 21
  • 32
0
votes
1 answer

Traversing directory without recursion in iOS

I need to traverse all the files in the folder structure of the directory accessed by the app from shared servers. With the inclusion static libraries I'm able to access various servers and the files shared in the them. List of all servers are…
DNamto
  • 1,342
  • 1
  • 21
  • 42
0
votes
1 answer

Create binary tree from inorder and post order traversal

I was trying to familarize with the question of creating a tree given inorder and postorder traversal. I wrote the following code, but some thing is going wrong which i was unable to find out. Can someone help me on this? Sample i/p : int in[] =…
user1643001
  • 207
  • 1
  • 2
  • 7
0
votes
2 answers

constructing random "integer" tree - depth-first / breadth-first

This is my first ever attempt at writing a recursive function in c. The following-code works. I apologize for the long posting, but I am trying to be as clear as possible. I am trying to generate a tree where each node (inode) has an integer field…
user151410
  • 776
  • 9
  • 22
0
votes
0 answers

Create a map of characters and their associated bitstrings from a huffman tree

I have coded the tree and now I am trying to traverse the tree and create a bitstring for each character and put these values into a map. Here is my code so far: map build_encoding_map(freq_info*& huffman_root) { map
0
votes
0 answers

Displaying value by value in a threaded binary tree using a "Next" button with a recursive inorder traversal

As the title states, having a bit of trouble mostly with the algorithm. I have the algorithm down to parse through and print ALL the values, but I need to be able to stop on each value and display it in a label. I tried using a global variable…
Craig Smith
  • 137
  • 1
  • 3
  • 16