Questions tagged [traversal]
Traversal is the action of iterating over all the elements in a sequence of elements.
1,943
questions
1
vote
1
answer
18
views
Fetched value is undefined jquery (traversal)
Actually am using Jqgrid but in browser console html look like this
<tbody>
<tr>
<td></td>
<td></td>
<td>
<input type="text" id="...
-1
votes
0
answers
18
views
How to print a postorder traversal of a BST after adding the nodes via an add method?
I am trying to create a script that adds a node to a BST tree without messing with the tree's order. I am almost confident that my add method is creating the BST correctly. But I would just like to ...
0
votes
1
answer
23
views
Binary Search Tree traversal using recursion to store in JSON
I am trying to write a function to traverse a tree and store the values in a dictionary. I am using a dictionary because I want the structure of the tree to be preserved in JSON format. But the return ...
0
votes
2
answers
45
views
Algorithm to traverse graph with certain dependency/constraint
So I am building a operations pipeline that allows user to apply certain Data operations on dataframes.
The operations are such that they may have "one-input-->two-outputs" or "one-...
0
votes
1
answer
63
views
How to traverse a graph with algorihtm
Need to find how many translators need for two persons to be able talking to each other.
Given values are
A : 1 2
B : 7 8
C : 4 5
D : 5 6 7
E : 6 7 8
F : 8 9
And the translators which we are looking ...
1
vote
1
answer
57
views
i am trying to read and print one value in a linked list , but my program does not give any output
i am trying to read and print one value in a linked list , but my program does not give any output, i have tryed checking where the program is failing to execute , after the first scanf the code is ...
-1
votes
1
answer
24
views
how to pick specific table rows by comparing its inner table cells with given criteria?
** I want to grab all the united states proxies from the site https://sslproxies.org/
I have grabbed all rows but unable to pick only those proxy records which have united states country
then I want ...
0
votes
0
answers
13
views
C# The program is not outputting what I want (Incorrect output)
My goal is to get the program printing 1 2 9 22 33 81 100 then 1 2 8 9 47 1000. The program is not outputting what I want (In correct output).
Here is the code
using System;
class BSS
{
static ...
0
votes
1
answer
25
views
Deleted binary tree has an incorrect subsequent traversal
I have an issue and it is really annoying me right now. I want to make a binary tree, delete it and then create a new one. I have been trying to make the program myself but I keep getting stuck on the ...
-1
votes
2
answers
98
views
Finding The Nearest Empty Spot On An Infinite Grid
This was an interview question I have been asked. It involves a 2D grid that consists of empty and occupied spots (0s and 1s if you will) of infinite size. The input contains the coordinates of the ...
0
votes
1
answer
54
views
Graph recursive DFS when cycles exist?
I'm interested in handling DFS in undirected (or directed) graphs where cycles exist, such that the risk of entering an infinite-loop is non-trivial.
Note: This question is not about the cycle-...
0
votes
2
answers
67
views
To retrieve data from list where it contains dictionary as its values (python)
I am newbie to python, trying to understand the concepts. I am trying to traverse a list, where inside list, I have kept dictionary data set which are initialized. I have defined function to traverse ...
1
vote
2
answers
37
views
Is it possible to traverse all connected nodes in a graph with DFS when cycles are present?
Is it possible to traverse all connected nodes in a graph with DFS when cycles are present?
g = {'a':['b','c'],
'b':['a','f'],
'c':['a','f'],
'd':['c','e'],
'e':['d'],
'f':['c'...
0
votes
2
answers
18
views
Same tree verification through recursive tree traversal
I've prepared a recursive tree-traversal based solution to the "same tree" problem. However, I'm encountering an error on use cases involving None values. Why is my approach incorrect and ...
0
votes
1
answer
41
views
How to get a node with specific value in a linked list?
I want to get a node with bno(branch number).
struct bank {
struct branch *branches; // to hold the branches of the bank
struct operation_type *optypes; // to hold the transaction types ...
1
vote
0
answers
33
views
DFS in virtual graph with cycles
Using a function that generates a list of "adjacent" values from an input value, i.e.
Function<Object, List<?>> adjacent;
one can "traverse" any "acyclic" ...
1
vote
1
answer
63
views
Traversing through a 2D array
I am trying to figure out how to traverse through a 2D array. The way in which I have been doing it is by using a nested for loop. I am curious to know of any other ways in which this can be done. I ...
2
votes
1
answer
93
views
How do I reverse transversal in a PowerShell array
Given a PowerShell array hashtable1 similar to the following:
$dept= @{
'Sales' = @{
'SAM' = 'Manager'
'SAP' = 'Person'
}
'IT' = @{
'ITM' = 'Manager'
'ITS'...
0
votes
2
answers
55
views
Time limit exceeded in GeeksForGeeks zig zig traversal in tree
I am working on the GeeksForGeeks ZigZag Tree Traversal problem:
Given a Binary Tree. Find the Zig-Zag Level Order Traversal of the Binary Tree.
Example 1:
Input:
3
/ \
2 1
Output:
3 1 ...
0
votes
2
answers
41
views
Get all elements between element type (h1's) and wrap in div
I have the below structure:
<div class="wrapper">
<h1>Header 1</h1>
<h2>subtitle 1</h2>
<p>aaa</p>
<p>bbb</p>
<p&...
0
votes
1
answer
150
views
Searching an array with user input and printing all elements that have this value
I'm trying to search an array for a certain value and display all the elements which contain this value in java. For example, the user selects the number 5, there are 3 projects stored in the array ...
0
votes
1
answer
42
views
Traversing through IGraphServiceCollectionPage
I have made a List of graph service collection page but I need to put if loop to see if email exits in the list.
Can someone help me t traverse.
This is the code
var authProvider = await ...
1
vote
1
answer
57
views
How to traverse a matrix starting from a random position in Java
I'm trying to write a simple Java program that can traverse a matrix (2D-Array) starting from any position in the matrix that the user specifies.
I started by declaring my matrix and filling it with ...
3
votes
1
answer
77
views
Folding indexed functors with access to contextual data
This is a question about traversing mutually recursive data types. I am modeling ASTs for a bunch of mutually recursive datatypes using Indexed Functor as described in this gist here. This works well ...
-1
votes
1
answer
24
views
Error: in creation of Linked List Display function
I am trying to create a linked list with display() function in it but i continuously getting error in it. a function not able to display element in output.
I have try various online solution of code ...
0
votes
1
answer
44
views
How to efficiently make a function call to each row of a 2D ndarray?
I'm implementing a KNN classifier and need to quickly traverse the test set to calculate and store their predicted labels.
The way I use now is to use the list comprehension to get a list, and then ...
0
votes
2
answers
104
views
traverse listnode in python
Can someone help me with how can I traverse through below given listnode in python. I have written this command and am getting such outputs.
list1=[1,2,4]
Command:-
print(list1)
print(list1.val)
...
0
votes
0
answers
60
views
Python Beautifulsoup traverse a table with particular text content in innerHTML then get contents until before a particular element
I have an html with a lots of table to traverse to like below:
<html>
.. omitted parts since I am interested on the HTML table..
<table>
<tbody>
<tr>
<td>
...
-1
votes
1
answer
58
views
Use of dots inside brackets to reach variable depth JSON in Jinja2 like ['object.subobject']?
It's easy to get a specific variable object from a JSON array in Jinja like:
array['somekey']
but what if i want to access a value deeper in the nested list like:
array['somekey.subkey']
These dots ...
0
votes
2
answers
72
views
Get all descendants of an entry
I have a huge referral system (Over 500k entries) that works like this
[{id: 1, name: "John", ref: 0},
{id: 2, name: "Jack", ref: 1},
{id: 3, name: "Bill", ref: 1},
...
0
votes
1
answer
117
views
How do I traverse through a linked list faster?
I'm trying to solve a problem which wants me to use doubly circular linked list as the container. I want to traverse through k nodes and erase the k'th node like this:
for(j = 0; j < k; j++)...
0
votes
1
answer
60
views
Batch Script Search & Delete all folders that match name "*Cache*" but leave out certain paths from traversal
As I asked in Q-title, how can I traverse the whole %SYSTEMDRIVE% root folder for any directory that contains *Cache* in it's name and fully purge that directory inside-out but leave out certain paths ...
0
votes
1
answer
36
views
Traversing sub squares in sudoku
I have a 2d array of n^2Xn^2 dimensions (like a sudoku board, does not have to be valid numbers). I want to traverse each subsquare of nXn elements and put them into an array, but I'm having ...
0
votes
1
answer
38
views
How to I traverse/loop through a tree of arrays? [duplicate]
I have my tree which a want to traverse through, each subtree might have different length:
const Tree = [
{
data: true,
subTrees: [{
data: true, subTrees: [{ data: true, subTrees: [] }...
1
vote
2
answers
117
views
For /d /r loop not traversing sub-directories for finding desired directory recursively in Batch/CMD script
As aforementioned in Question title, I have a Batch/CMD(OS: Windows 10 64Bit) script to traverse the subfolders inside %LocalAppData% if the passed argument to script is Chrome, and recursively find ...
1
vote
1
answer
37
views
How does double recursion work in a tree traversal function?
I've seen code for a binary tree traversal function, and saw it was using double recursion:
public static void PrintTree(BinNode<int> t)
{
if (t != null)
{
...
0
votes
1
answer
22
views
Parse list and print all final paths
Given lines with different indentation
orange
blue
yellow
black
white
green
Print all final paths.
Expected output
orange/blue/yellow
orange/blue/black
orange/blue/white
orange/green
How to ...
-1
votes
2
answers
47
views
How should i traverse inside two dimensional array list using for each loop
public List<String> findItinerary(List<List<String>> tickets) {
// creating adjencency list
for(String[] ticket : tickets)
{
map.putIfAbsent( ticket[0] ,new ...
0
votes
3
answers
86
views
How to determine if sequence is within the list of ints?
I am having trouble when running a python program. The purpose is to determine whether the sequence 1, 2, 3 is within a given list of ints. When it runs two of the tests, the code works. However, the ...
0
votes
1
answer
39
views
Traversal Parsing of Text from .HTML
I am trying to scrape text from webpages contained in tags of type titles, headings or paragraphs. When i try the below code I get mixed results depending on where the url is from. When i try some ...
1
vote
0
answers
21
views
jquery (Traversing) find prev element with specific class
I am trying to find first previous element with specific class name (in my case element which ends with word "group") and return its value(text).
If you look at my demo code you ll see that ...
0
votes
1
answer
164
views
BFS Traversal of a Binary Tree in C
While I know there are cleaner more efficient programs out there for BFS traversal in other languages, in c it gets a bit lengthy
I've found some really lengthy and complicated programs on leetcode, ...
0
votes
0
answers
17
views
LeetCode 101 Symmetric Tree code not returning True [duplicate]
I'm working on LeetCode 101 Symmetric Tree in Python:
Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center).
Obviously I can find the answer ...
0
votes
1
answer
87
views
How to find a binary tree depth using breadth-first algorithm in Golang
I have a binary tree and I would like to find its maximum depth using a breadth-first approach.
I think I am having a logical error in where to increment the depth.
// You can edit this code!
// ...
0
votes
0
answers
53
views
Inserting element into linked list while traversing C++
I'm new to C++ and having some difficultly with the use of shared ptrs. I've been able to construct a linked list. I want to traverse the linked list, and when the nodes (elements) have a valid to_add ...
0
votes
1
answer
111
views
Graph Traversal (is there a connection between source and destination nodes in the graph) - visited DFS vs BFS
I don't understand for potential cyclic graph traversals, why for is there a connection between source and destination node in the graph:
i) DFS, if a node is visited, we return false
ii) BFS, if a ...
0
votes
0
answers
41
views
Find longest DFS sequence with backwards traversal
I have a list of nodes ordered by timestamp. Each node has information of its parent, and the sequence of nodes is given by their time.
time node parent
12:00 A *
12:01 B A
12:02 ...
1
vote
1
answer
47
views
Problem in traversing a linked list after finding the middle node
I'm just starting to learn Algorithms and Data Structures in Python and I've come across this linked list problem. Overall I've managed to find the middle node the naive way but I don't understand why ...
0
votes
1
answer
43
views
OrientDB - get all paths from one vertex
I'm using OrientDB Community Edition 3.2.3.
This is the graph of my data:
[1]: https://i.stack.imgur.com/5yK7C.png
I would like to get all the paths that are connected to the node #17:9.
I tried the ...
-1
votes
2
answers
100
views
Is there a Scala way of selecting a subset of List[Array[Int]] by checking each element of each Array[Int]?
New to Scala. I have data of the form List[Array[Int]],each Array[Int] has n integers, call this a. There are also two Array[int], call them c and d, also of length n. I want to compare each element ...