Questions tagged [traversal]

Traversal is the action of iterating over all the elements in a sequence of elements.

Traversal, in the context of programming languages, usually refers to the act of visiting all the elements in a sequence of elements - be it an array, a set, a list, or any other data structure.

Examples: Tree Traversal

2003 questions
0
votes
1 answer

how can I traverse in guava table

how to traverse in guava table ? I have such a table 0 --> 1 [16, 48, 32] 0 --> 2 [38, 19, 17, 28, 48] 0 --> 3 [37, 41, 31, 16] 1 --> 0 [19, 24, 37, 11, 14, 32] 1 --> 2 [45, 15, 37, 22] 1 --> 3 [22, 31, 16, 28, 33, 37] 2 --> 0 [15, 23, 49,…
Buğra
  • 33
  • 5
0
votes
1 answer

How to apply bluebird promises to my existing javascript traversal and recursive based logic?

I am curious to know how can I make use of bluebird promises in my existing javascript code that makes use of lots of callback based mechanism. Here is the scenario: In my web application on page load using jQuery, I will get page's main menu links…
Faisal Mq
  • 5,036
  • 4
  • 35
  • 39
0
votes
1 answer

Traversing backward from iframe inside a model a window

i have a modal popup built with jquery UI ($.dialog) that contains an iframe (id='myIframe') with a login form. the login func calls via Ajax and give access to the user, then it should redirect the user to a different page...but instead it load the…
Francesco
  • 24,839
  • 29
  • 105
  • 152
0
votes
0 answers

How to create a binary tree with in-order and pre-order traversals?

I found the implementation for creating a binary tree with in-order and pre-order traversals (http://www.geeksforgeeks.org/construct-tree-from-given-inorder-and-preorder-traversal/), and I understood everything except the following: // What…
user6898719
0
votes
1 answer

Check if index is OutOfBounds in a 2D array

So I'm building a sort of "Game of Life" application in java and are having some trouble detecting when the index is out of bounds.The code below is a modified version from another qustion here from SO. 2D…
0
votes
2 answers

How to split a tree on all possible subtrees?

I'm trying to build an iterator on JS that will take a tree and on each iteration return next possible subtree. Here is an example of source tree: { name: 'A', children: [ { name: 'B', children: [ { name: 'E' …
Dimitry
  • 99
  • 1
  • 8
0
votes
2 answers

How to traverse HTML

I have a variable with the HTML code: let htmlDocument = '
\
\

Britney Spears' House

\
\
falafel
  • 23
  • 3
  • 13
0
votes
0 answers

how to programming pre / in order traversal without recursion in python

here is my code about postorder_nonrecursive. I want to know preorder and inorder like this code. please help me! def postorder_nonrecursive(self): if self == None: return stack = [[self,0]] while len(stack) >…
J.Doe
  • 35
  • 5
0
votes
1 answer

Prolog- family tree of children

If I wanted to recursively go down a family tree in prolog and return only the children of every branch, how would I start that? Thanks
userJoe
  • 73
  • 2
  • 12
0
votes
3 answers

avl tree in order traversal

Let S be a dynamic set of integers. Let n = |S|. Describe a data structure on S to support the following operations on S with the required performance guarantees: • Insert a new element to S in O(log n) time. • Delete an element from S in O(log n)…
101ldaniels
  • 301
  • 1
  • 6
  • 15
0
votes
2 answers

Traverse JSON object to build JSTree

I have a JSON object and want to traverse it so that it matches the structure of JSTree: Original JSON: { "analogBasebandProcessorBoardType": "Test_BOARD", "tuners": { "tuner1": "RFE_MAIN", "tuner2": "MAX93" }, "allowedSoftConfigs":…
bademeister
  • 107
  • 1
  • 11
0
votes
1 answer

Recover Binary Tree

For this question on leet code, this code is passing all the test cases. class Solution(object): def recoverTree(self, root): self.first = None self.second = None self.prev = TreeNode(float('-inf')) self.traverse(root) temp =…
0
votes
2 answers

jsoup: traversing an object of type Element backwards

Connection con = Jsoup.connect(https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8); //Just giving an example Document htmlDoc = con.get(); Elements linksOnPage = htmlDoc.select("a[href]"); for(Element link :…
user3868051
  • 1,147
  • 2
  • 22
  • 43
0
votes
1 answer

Multi-dimensional array traversal with Symfony Form Validation

I have an array of multi-dimensional array that represents my form each level represents a child form until you get to a field. I want to be able to traverse that array keeping track of where of where I have been so I don't go down the same route…
Kal
  • 2,239
  • 6
  • 36
  • 74
0
votes
0 answers

Java, Python - Error in using Java LinkedList in converted Python code

I am working on an algorithm that is related to the Transportation Problem, originally written in Java. You can see the source code here. I have to convert it into Python. In the linked source above, there is a function getClosedPath(...) static…
1 2 3
99
100