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
2 answers

Traversal of Giant LinkedList

For a project I am required to write a method that times the traversal of a LinkedList filled with 5 million random Integers using a listIterator, then with LinkedList's get(index) method. I had no problem traversing it with the listIterator and it…
Cole Dooley
  • 47
  • 1
  • 7
0
votes
1 answer

Zig-Zag Triangle Traversal Implementation

I was trying to follow "On the Hardware Implementation of Triangle Traversal Algorithms for Graphics Processing" (Royer, Ituero, Lopez-Vallejo, & Barrio) (page 4) to implement Zig-Zag traversal algorithm for triangle triversal/rasterization.…
Provi
  • 66
  • 9
0
votes
1 answer

JQuery next() issues

I am trying simplify this images rotator function using the next() and end() but I can't figure it out. The goal is to iterate over images, set the title and move to the next image. How can I make this work? here is my basic html code
guyndjeng
  • 1
  • 1
0
votes
1 answer

Traversing Through List of Objects in React/Jsx

I'm having trouble trying to traverse through a list of objects in JSX. renderBooks(book) { return(
A new book
{book.id}, {book.timeIn} ); } render() { console.log("the values are",…
lost9123193
  • 10,460
  • 26
  • 73
  • 113
0
votes
3 answers

How to gracefully traverse a string in C to the end

I am working on a C function which must input a string and remove all the non-letter characters at the beginning only. For example, if the input string was "123 456 My dog has fleas." then the output string must be: "My dog has fleas." Here's what…
Pete
  • 1,511
  • 2
  • 26
  • 49
0
votes
3 answers

`std::forward_list` walk until iterator is null?

Is it possible to walk a std::forward_list, incrementing an iterator, until said interator is null? The old-fashioned way... In the following example, I create a print() function. #include #include void…
kmiklas
  • 13,085
  • 22
  • 67
  • 103
0
votes
1 answer

Total Beginner Needs Help Parsing Complex JSON Array

* Edited with new, complete, JSON data * I am going to apologize in advance as I'm a total coding neophyte. The manager who decided to try a project. I was hoping someone could help me with a code snippet to parse the following ugly JSON result.…
0
votes
1 answer

Traverse and count directory paths

I have a flat list of directories: var directories = [ { path: '/a', status: 0 }, { path: '/a/a', status: 1 }, { path: '/a/b', status: 1 }, { path: '/a/c', status: 0 }, { path: '/b', status: 0 }, { path: '/b/a', status: 0 }, …
Kim T
  • 5,770
  • 1
  • 52
  • 79
0
votes
3 answers

How do you traverse int[][]?

I tried doing: for (int i=0; i
Devoted
  • 177,705
  • 43
  • 90
  • 110
0
votes
2 answers

Traversal on different criteria using iterator pattern

Here is the problem: Suppose I have a huge collection of Person object, and I need to traverse the list in different ways. For example, iterate a list of people born in 1980, or live in New York City. Write down the code using ITERATOR pattern to…
Taylor
  • 13
  • 2
0
votes
1 answer

Rooted tree with huge depth - DFS Traversal algorithm performance

Today, I learnt 3 DFS(Depth First Search) traversals for rooted trees i.e., In-order, Pre-order & Post-order traversals. For instance, If I consider Pre-order traversal, typedef struct SiblingTreeNode { struct SiblingTreeNode *parent; void…
overexchange
  • 15,768
  • 30
  • 152
  • 347
0
votes
1 answer

How to traverse a tree structure in order to draw a graph?

I'm working with JGraphT library to draw a graph for my tree structure but the library draws a graph based on a given set of nodes and connected edges.I have read the Class "DirectedAcyclicGraph.VisitedArrayListImpl" in the library javadoc but I did…
Dee
  • 1
  • 1
0
votes
3 answers

Traversing all values of an array of arrays

N in this question means any arbitrary number of any size and is not necessarily (but could be) the same. I have an array with N number of key => value pairs. These key => value pairs can also contain another array of size N with N number of key =>…
bmarti44
  • 1,247
  • 2
  • 14
  • 22
0
votes
2 answers

Java : Recursive Depth First Traversal

Can someone point out what is wrong with my code? From what I observed, return root doesn't work properly as it should. private Node find(String name, Node root) { if (root != null) { if (root.name.equals(name)){ …
Shane Ong
  • 11
  • 1
0
votes
1 answer

Depth-First Search of a Graph

I am a bit confused with this example . Normally the depth- first search of a graph is done in alphabetical/ increasing order . (Is it possible for vertex M to be visited third? starting from vertex B ) . Can someone please explain this to me :
1 2 3
99
100