Questions tagged [search-tree]

A tree shaped data structure which allows for storing orderable data so it may be efficiently searched later.

A tree shaped data structure which allows for storing orderable data so it may be efficiently searched later.

46 questions
97
votes
17 answers

Knight's Shortest Path on Chessboard

I've been practicing for an upcoming programming competition and I have stumbled across a question that I am just completely bewildered at. However, I feel as though it's a concept I should learn now rather than cross my fingers that it never comes…
Kyle Hughes
  • 1,269
  • 2
  • 14
  • 13
20
votes
2 answers

Completeness of depth-first search

I quote from Artificial Intelligence: A Modern Approach: The properties of depth-first search depend strongly on whether the graph-search or tree-search version is used. The graph-search version, which avoids repeated states and redundant paths, is…
12
votes
4 answers

Is there a program that can draw a search tree of Prolog queries?

I was wondering if there exists a tool that can draw a step-by-step search tree of a Prolog program? Thanks.
IDDQD
  • 3,109
  • 6
  • 24
  • 36
9
votes
2 answers

How to functionally generate a tree breadth-first. (With Haskell)

Say I have the following Haskell tree type, where "State" is a simple wrapper: data Tree a = Branch (State a) [Tree a] | Leaf (State a) deriving (Eq, Show) I also have a function "expand :: Tree a -> Tree a" which takes a…
wen
  • 3,712
  • 8
  • 32
  • 54
8
votes
2 answers

How to Find the Branching Factor of a Tree

A particular search tree has 6 nodes at level 3. At the next level, there are 24 nodes. What is the branching factor at level 3? The answer is 4, but can someone tell me why, I thought that it was 2.
blazing
  • 455
  • 1
  • 4
  • 16
4
votes
1 answer

Some doubts about Prolog implementation of 2-3 Dictionary

I am learning Prolog using SWI Prolog and I have some doubts about how work this implementation of the 2-3 dictionary in Prolog. I know the theory of the 2-3 dictionary that are trees whose internal nodes can generate 2 or 3 subtrees having the…
AndreaNobili
  • 34,200
  • 85
  • 240
  • 456
2
votes
0 answers

Improving Stockfish computation to generate best possible move

I use the stockfish engine to generate the optimal moves in an simulated chess game. I use python-chess to integrate the Stockfish engine in my simulation. At the moment I set the depth of the search operation for the optimal move with…
sebko_iic
  • 394
  • 2
  • 8
2
votes
3 answers

Path planning for multiple robots simultaneously

Image1 represents the problem perfectly and shows the freedom of motion the robot is capable of. Square-> Origin, Circle-> Destination. These are two robots that will be working simultaneously. How to guide these robots without deadlocking each…
Perseus784
  • 94
  • 1
  • 9
2
votes
1 answer

Tree with exponential split factor

What do you call a search tree with a split factor of 2^k, where k is the dimensionality of the data points stored within the tree? (The data points are vectors x_1, ... x_k) For k=1 we would get a normal binary search tree. For k=2 we would split…
Tim Kuipers
  • 1,514
  • 1
  • 15
  • 24
2
votes
1 answer

Using "Treap" to compare two set

I want to use Treap structure,but I don't familiar with this type of tree well. I have two set and i want to write a method to compare them with Treap. This method should return a value that show the similarity of two set. (My work is retrieve a set…
SahelSoft
  • 586
  • 2
  • 7
  • 18
1
vote
1 answer

How to calculate the average branching factor on a given tree

Can anyone explain to me, what the value of the average branching factor is if we exclude leaf nodes when computing b? Example: I don't know how to calculate this in the right way :/ Thanks a lot
1
vote
2 answers

Tree Search - given two nodes in a tree, check if they are connected - python

Given a search tree, e.g. "1" └ "2" ├ "2.1" ┊ └ "3" ┊ └ "2.2" └ "2.2.1" └ "3" As well as two nodes, a and b, that belong on that tree, e.g. "2.1" and "3". How can we check whether a and b are parent-child (or…
Sergey Ronin
  • 681
  • 6
  • 22
1
vote
2 answers

Dynamic Programming for the number of ways of climbing steps

The question is to write a function using dynamic programming for the number of ways to climb N steps. Given that only 1 step or 2 steps can be climbed at a time. For example, if N=3, the function should return [(1,1,1),(1,2),(2,1)]. I've written…
1
vote
2 answers

Print function not reading freed values correctly

I'm working with search trees, and to see if the tree ended I check if it's null. My problem is when I use free() the pointer value doesn't become NULL. I've also tried using a pointer to free and then set to NULL but it didn't work. In this case I…
1
vote
0 answers

How can I build string matching tree from array of regex-es?

I've got dynamic(sometime changes) array of regular expressions, for example URL path structure: /(home)?$ -> home view /news/(index)?$ -> /news/([a-zA-Z0-9_]+)/?$ -> news article view( arg_1 ) /news/([a-zA-Z0-9_]+)/reply_to_comment\?(.*) -> news…
kravemir
  • 9,380
  • 15
  • 54
  • 99
1
2 3 4