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
0
votes
1 answer

Write entries of a searchtree(non-binary) into a list. (Iterative)

I am trying to write all entries of a search tree into a list. In unchanged order, nodes before children. But I mix the order up somewhere along the way. def n(value, children=[]): return [value,children] #I want to keep this order in the…
PeterPefi
  • 43
  • 4
0
votes
0 answers

Search in associative array by key

I have a set of numbers where each number has a key (ex. {"key1":1, "key2":2}). All the keys are unique. What is the best data structure to store them such that I can search by a key and find the value of that key efficiently? (possibly in logN…
Mateo
  • 63
  • 4
0
votes
2 answers

Storing values in binary search tree with C++

This code for a standard binary search tree does not contain any information, only the value of the nodes. Is there any way I can contain another value, for example, age, in the nodes? So that the node number will be id and the value it is carrying…
Iqra Abbasi
  • 101
  • 6
0
votes
0 answers

Max number of cores in a recursive search tree with Open MP

I want to implement a search tree using a recursive function. In each node, I evaluate a function Pass_or_Die. If Pass then the node is extended into n more branches, otherwise it dies. Suppose a node passes with a certain fixed probability. Suppose…
0
votes
2 answers

Finding values between min and max in 1d array in Javascript

I have an array with values and I need to find all values between min and max. I believe I need to construct some kind of search tree, is that correct? I want something like: var values : number[] = tree.findBetween(min : number, max: number); The…
daniel.sedlacek
  • 6,703
  • 7
  • 35
  • 74
0
votes
1 answer

Search tree node via closure in Google Apps Script

General problem I'm trying to solve I'm trying to implement a search tree in Google Apps Script, sorted by pkgName attribute, with the end purpose of comparing imported metadata on a software project against a Sheet containing similar data. To keep…
Mike Warren
  • 3,042
  • 4
  • 29
  • 76
0
votes
1 answer

How to create a binary search tree from string?

I tried to create a Morse encoder-decoder, and I have to do it with binary search tree (not with arrays). The following part supposedly takes a character array (which we created previously from a text file), and creates a search tree based on it. In…
Heves
  • 3
  • 2
0
votes
0 answers

Backtracking—convinient way to store resulting DataTree on Filesystem

I have created a backtracking algorithm, but after a while the program runs out of memory, since the amount of results is so huge. So I am about to find a way to store the resulting Data Tree onto the Filesystem, rather than the Memory/RAM. So I am…
philipp
  • 13,819
  • 10
  • 50
  • 87
0
votes
1 answer

Confusion whilst drawing query search tree?

We are working with the following knowledge base: house_elf(dobby). witch(hermione). witch('McGonagall'). witch(rita_skeeter). magic(X):- house_elf(X). magic(X):- wizard(X). magic(X):- witch(X). The question of the exercise was: Which of the…
CJ Carter
  • 27
  • 8
0
votes
1 answer

Ruby Search tree example confusion

I've been trying to take apart this app which creates a search tree based on keywords, but I'm afraid its a bit too complex for me. Would anyone mind explaining it? The format is off, so here's a pastebin (is pastie.org down?) version of it. Any…
sent-hil
  • 16,955
  • 15
  • 53
  • 71
0
votes
1 answer

Deleting Parts of Binary Search Tree

I am trying to solve the following problem: Return the root of a binary search tree t modified to contain only values <= k. (Using the normal BST class where we have an item,left and right) def prune(t,k): if not t: return None if k…
Mac
  • 123
  • 4
0
votes
1 answer

Tree traversal to find the most 'logical' SQL joins between two tables

I'm creating a report builder-like application with the intent on making an extremely novice friendly front end. The back end of the application will be managed by developers who can build a 'report model' which will specify which tables, fields…
Lex Webb
  • 2,462
  • 2
  • 18
  • 33
0
votes
1 answer

algorithm - lookup tree with closest path prefix fallback

I am after an algorithm for a problem where I maintain a tree structure on which I need to find the closest match for a data node. If no exact match, it falls back to the closest prefix. For example, if say I have the below structure, where the…
ϹοδεMεδιϲ
  • 2,207
  • 3
  • 29
  • 49
0
votes
2 answers

Knight's shortest path graph data structure and algorithm

I have a question on one of the previous Stack Overflow post @ Knight's Shortest Path on Chessboard I understand the reply on 'ok, it's a graph question, and its sparse matrix is like': (a1,b3)=1, (a1,c2)=1, ..... which describe existing edges.…
user1559625
  • 2,382
  • 2
  • 27
  • 56
-1
votes
3 answers

PHP/MySQL tree that is inifinite

I've got a tree-algorithm and database problem I'd like to have an answer to. I've got a few areas, let's say 20. Each of these areas have sub-areas ~ 20 each. These parent areas are spread out on a map. Some of these parent areas are close to…
Asbestos
  • 196
  • 9