Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
0 answers
5 views

Traverse a graph with multiple stops from a starting point? [duplicate]

I have an undirected weighted graph I need to traverse from X node to a list of nodes. The list is unordered by default, meaning that the order of which nodes are traversed is not important. What's ...
hesoyam's user avatar
0 votes
0 answers
42 views

How can I estimate the difference in performance of a HashMap lookup vs List iteration in Kotlin?

I am working on an application that needs to map pdf documents to corresponding json data files (see: Kotlin data structure for efficient lookup of nested data for more details). In trying to ...
pbuchheit's user avatar
  • 1,663
-1 votes
0 answers
66 views

How to determine if a node in graph is connected to another node efficiently? [closed]

Now I know some people will suggest DFS or BFS etc etc, but I am looking for other faster approaches. The graph I'm working on has "mixed" directions - some edges are directed but some aren'...
UndefinedCpp's user avatar
0 votes
1 answer
46 views

Checking a candidate majority element: Does my simplification work with all cases?

Here are the details of the problem: Given a sorted array arr of N elements. A majority element in an array of size N is an element that appears more than N/2 times. The task is to write a function ...
Gargouri Nourallah's user avatar
0 votes
0 answers
40 views

Finding a $ ( non-numberic) in an array of numbers whose N is not known

Recently I got the above question. Here, $ (a non-numeric) data is to be find out in an array whose N (Length) is not known. One simplest approach is linear search by going one by one and comparing ...
Jaykumar's user avatar
  • 363
1 vote
4 answers
81 views

The minimum size of substrings for the presence of at least one character

i have a question that want the minimum length of k that in each consecutive substring of a string with length k, There must be at least one common character. for example if s="abcaca" for k ...
Amir Hossein's user avatar
0 votes
0 answers
21 views

Goal-Oriented Action Planning Regression Logic Confusion

The image below shows the original example of GOAP regressive search by Dr. Jeff Orkin. It is explained that the planner searches regressively the space of actions for a sequence that will take the ...
Ken Love's user avatar
0 votes
0 answers
18 views

"TypeError: 'NoneType' object is not iterable" is thrown when I run a function to check the neighbors of a point on a 2d list [duplicate]

I have recently challenged myself to code the Depth First Search algorithm for maze generation with only a description. I have seemed to hit a roadblock in which my function for checking previous ...
Wyatt M's user avatar
  • 33
0 votes
1 answer
50 views

Travel from city 1 to city n, visiting at least 3 odd cities

Problem: Find the minimum cost path from city 1 to city n visiting at least 3 odd cities, only moving forward. It costs c[i][j] to go from i to j. I have to solve this defining search problem class(...
Murad Aliyev's user avatar
0 votes
1 answer
34 views

Why is the time complexity of bidirectional bfs still O(V+E)?

I understand that if the branching factor of the graph is b and distance of goal vertex from source is d, then the time complexity is O(b^d). I also understand why that would be O(b^d/2) using ...
Shisui's user avatar
  • 1,120
1 vote
0 answers
84 views

A*: Rotating pipes puzzle heuristic

School Project: Create an AI who will use A* search to resolve a rotating pipe puzzle (similar to this game pipes_puzzle_game). To solve this project I represented every possible board configuration ...
stfp04's user avatar
  • 59
2 votes
4 answers
75 views

Optimized on-disk data structure for search with minimal random accesses

I have a huge file (~16TB) that contains a list of 8-byte keys mapped to 8-byte values. (2^40 pairs, 16 bytes each). I would now like to optimize the file so that I can search it efficiently. I have ...
Frederik's user avatar
0 votes
1 answer
55 views

Using a* algorithm without having distances [closed]

I have a list of nodes and all of their neighboring nodes. I am trying to get from node X to node Y in the shortest path using A*. What heuristic should I use?
Gil Kor's user avatar
  • 342
0 votes
1 answer
95 views

Why this A* implementation works for 8-puzzle entries and not for 15-puzzle entries?

THE FULL CODE IS IN THE ANSWERS BELOW I'm gonna dissect this problem I'm having completely, contextualizing the full program and what each part of it do, because I don't know which part is not ...
Lairon's user avatar
  • 9
0 votes
0 answers
41 views

Binary search comprehension problem. how can a '<' / '>' symbol be checking for strings?

My code works OK. The problem here is comprehension. I get that it splits and goes back and forward in the search. What I don't get is how to give a descriptive explanation on what each code line is ...
Jose Salduna's user avatar

15 30 50 per page
1
2 3 4 5
149