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

OrientDB Edge From To Confusion

I'm new using Graph Databases and I'm a little confused about the concept of From / To or In/Out in OrientDB. Which is the best approach to define which Vertex is From and which is To? Or Both for example when is a relation of contact in social…
Nelson
  • 7
  • 3
0
votes
1 answer

Traversing an Unknown Level of Users for an Organizational Chart

I'm working on an organizational chart in PHP, and the data is retrieved from a database. An example of the organizational chart looks like the following, but it has an unknown number of levels: Me Brandon David a. Amanda b. Michelle c.…
0
votes
3 answers

go back(traverse up) from "this" and find specific element with jQuery

Even with jQuery traversing from a specific point is sometimes a riddle to me. My HTML Structure looks like this:
Bill Bronson
  • 530
  • 2
  • 9
  • 24
0
votes
1 answer

Retrieving an element by index in Java linked list

I am writing a linked list (not using Java's) and trying to create a get method to return an element of the list by its index number. Originally, I wrote this using a for loop. My code is repeatedly failing a test in which it retrieves the element…
Caroline
  • 85
  • 7
0
votes
1 answer

Perl script is not recognizing all directories using -d flag

I am having issues getting my Perl script to recognize some subdirectories when traversing through my file system. Please note that this is part of a homework assignment, and I am unable to use modules of any kind. I have attempted to troubleshoot…
M.Wilson
  • 3
  • 1
0
votes
1 answer

NxM Matrix Traversal

I am struggling with my algorithm for the following question: Given a rectangular matrix which has only two possible values ‘X’ and ‘O’. The values ‘X’ always appear in form of rectangular islands and these islands are always row-wise and…
Natasha Kelly
  • 73
  • 1
  • 12
0
votes
1 answer

Matching everything between two HTML elements with jQuery

I have empty elements that can be anywhere in the DOM. They have a specific class and id like and . So I can identify the starting point and the endpoint via the id. I now want…
0
votes
1 answer

Longest Path: Recursive Backtracking with Constraints in C

I was recently assigned a problem, which boils down to finding the longest path in a given matrix, where two cells are adjacent iff the neighboring value is less than the present cell. I've been tearing my hair out trying to figure it out, so I…
0
votes
1 answer

Traverse to an element and add a class to it

I'm sure this is very easy but its a friday afternoon and my brain is a little frazzled. Any help would be appreciated I am looking to traverse to an 'a' tag within a 'li' tag. The li tag has a class of 'menu-item-has-children'. I am trying to add…
CraigDev
  • 113
  • 1
  • 12
0
votes
1 answer

Depth traversal Orientdb

How can I get depth traversal of a graph in Orientdb . Using the documentation here is what I tried , yet when I run in I get an error here is the query . EXPLAIN SELECT FROM (TRAVERSE any("Edge1") FROM P_H WHILE $depth <= 3) WHERE p…
Muna arr
  • 353
  • 2
  • 13
0
votes
2 answers

Traversing an Array Javascript

I'm supposed to use a while loop to traverse this array and multiply each item by 2. The page just keeps loading forever when I try to run it.... What am I missing? Thank you. var prices = [4, 5, 8, 10]; var i = 0; while (i < prices.length){ …
0
votes
0 answers

Jquery - Find Previous 'a' class

This is probably very simple but I can't seem to put it together. I am simply trying to find the class of the anchor tab that apears right before my input field. My code looks like this: $(':input[required]').each(function () { if…
user982853
  • 2,470
  • 14
  • 55
  • 82
0
votes
1 answer

Neo4j Graph depth traversal Cypher

I'm using neo4j as a graph database and I want to return from a starting node neighbors of that node, and all the related neighbors to a depth varying from 1 to 3. I'm Doing this but it gets stuck: Note that it is a large graph. start n = node(*)…
Muna arr
  • 353
  • 2
  • 13
0
votes
1 answer

How do you create a string representation of an in-order traversal that is recursive?

I have to create and return a string representation of the in-order traversal of a Binary Search Tree. Below I do have the in order traversal, but I can not figure out how to change this into string form. I did try using + to concatenate them…
oppa76
  • 21
  • 4
0
votes
2 answers

Iterate bits from left to right for any number

I am trying to implement Modular Exponentiation (square and multiply left to right) algorithm in c. In order to iterate the bits from left to right, I can use masking which is explained in this link In this example mask used is 0x80 which can work…
TechJ
  • 512
  • 2
  • 5
  • 16