Questions tagged [tree-search]

46 questions
1
vote
1 answer

Performance comparison of binary search tree functions

I have these two binary search tree search functions. My question is which one of these functions are more efficient, or if they are equivalent? Given type 'a tree = | Empty | Node of 'a * 'a tree * 'a tree let rec search x t = match t…
v_head
  • 759
  • 4
  • 13
1
vote
1 answer

Pausing a recursive depth-first search

I have a basic recursive depth first search program that searches unexplored paths in a large tree. Is there a way to pause and save the tree so I can resume searching later rather than restarting the search every time I end my program? I am using…
Koji
  • 85
  • 4
1
vote
0 answers

What is the best way to model this grid?

I am coding an artificial intelligence program to solve the following problem: There are k robots in different cells of an m*n grid. some of the cells of this grid are poisonous (and the robots know which cells are poisonous). In every step, each of…
K.N
  • 871
  • 2
  • 10
  • 30
1
vote
2 answers

How can I search the tree structure in LINQ or some other way

public interface IComponent { Guid Key { get; set; } } public interface ICanHaveChildElement { List ChildElement {get;set;} } public class BaseComponent : IComponent { public Guid Key { get; set; } } public class TextBox :…
Harun
  • 51
  • 1
  • 6
1
vote
1 answer

DFS "Can Return Any Path"

This is from a practice AI exam from University of Berkeley, California. The question posits Consider the state space graph shown above. A is the start state and G is the goal state. The costs for each edge are shown on the graph. Each edge can be…
maddie
  • 1,854
  • 4
  • 30
  • 66
1
vote
1 answer

Does this addition preserve the space and time complexity for DFS?

So I implemented standard Depth First Search for a tree of nodes, where each node encapsulates a state of a problem I'm solving and I also added the method below to check that I'm not going to repeat a move by expanding a node which encapsulates a…
1
vote
1 answer

find lowest common ancestor of two Tree nodes, without reference to root?

class TreeNode { TreeNode parent; TreeNode left; TreeNode right; // other data fields omitted - not relevant } You are given two nodes p, and q, how do you find the lowest common ancestor? (Assume they both belong in a very large…
One Two Three
  • 22,327
  • 24
  • 73
  • 114
1
vote
1 answer

Monte-Carlo-Tree Search not working

I am currently writing an AI for the board game Hex. I want to use Monte-Carlo-Tree-Search to do so and have already tried to implement it. However, the AI makes incredible stupid (random) moves and I can not figure out why it`s not working. import…
1
vote
3 answers

Search for an item in an n-ary tree

I have a tree n-ary composed in this way: struct n_tree{ struct list *adj; }; struct list{ struct n_tree *child; struct list *next; int key; }; How i can search an item? I have implemented this function, but it does not work...…
b00k3r
  • 11
  • 1
  • 3
1
vote
0 answers

How minimax algorithm return an actual move?

im working on minimax algoritm now, i have a problem to compare each node and cant return the best node. once i can compare it, it still choose the bottom of the node, can someone help me to fix my codes ? here is my codes: public Node…
1
vote
0 answers

Line of Sight Algorithm for Graph/Tree search

I implemented Bresenham's line algorithm in Python for identifying the occupancy of the grids between a noted list of grid cells for a Grid world (say [(1,1), (3,2),(5,6),(8,4) in a 10X10 grid world with some occupied grids) and then applied line…
1
vote
1 answer

Optimal solution to find the leafs of a tree

I have a tree-like structure. I can get several lines that connect together and make up the tree. The lines are made up start-points and end-points. here is some sample data from a tree in XML format.
mahsa.teimourikia
  • 1,664
  • 9
  • 32
  • 64
1
vote
2 answers

T-SQL Tree Search Select from set of nodes if they are under a parent

T-SQL Tree Search Select from set of nodes if they are under a parent I have a very large tree in a MSSQL Db (80000+) records. My client has requested a quick search of the tree via a text LIKE command. The LIKE command returns < 500 records. Is…
Bill Bonar
  • 1,017
  • 2
  • 10
  • 22
0
votes
0 answers

Search function in DNATree

I try to insert AA. And then search AA$ to find exactly node "AA". But the result, I receive is "No sequence found". I need your support to help me find the solution for that problem. Thank you very much.
0
votes
0 answers

How to represent a numerical dataset as a tree search for an interval pattern mining purpose

I am a phd student in data mining and i want to use constraint programming to solve pattern mining tasks, Knowing that constraint programming is based on a tree search, i would like to know if there is a common way to represent the data of a…