All Questions
Tagged with algorithms trees
52 questions
0
votes
0
answers
182
views
Is there a known algorithm for reducing a tree based on a list of its leaves?
For a given, tree-like data structure:
- Alan
- Barbara
- Charlie
- Cecil
- Brian
- Chris
- Candice
- Cohen
- Boromir
- Corcoran
-...
7
votes
2
answers
632
views
some misunderstanding in concept of Huffman algorithm
What is difference between Average length of codes and Average length of codewords in Huffman Algorithm? is both the same meaning? I get stuck in some facts:
I see a fact that marked as False:
for a ...
5
votes
1
answer
1k
views
What do I not understand about Alpha-Beta-Pruning in Chess?
I'm trying to write a chess engine, Min-Maxing works. Now I wanted to implement Alpha-Beta-Pruning, but despite reading about it and watching videos, I must have a severe misunderstanding somewhere.
...
2
votes
1
answer
449
views
How a Merkle tree can work with Graph data, or a better data structure
I am looking at blockchain and trying to see how Merkle trees (or perhaps Merkle DAGs) can fit to a graph data structure with circular references.
For example, say I have this data model:
var ...
1
vote
0
answers
76
views
Decision tree for storing subscription info
I have a system in which user creates an entity. Now this entity has attributes which are dependent on many external systems. We have all those pipelines in backend which updates these entities when ...
2
votes
1
answer
379
views
Algorithm: Binary Search / Tree / Partitioning on unsortable data?
First, this question is not really about binary search as I neither have sorted data, nor any sortable data at all. :-)
W.r.t the "unsortable" claim see below; but I think the title term "unsortable"...
4
votes
3
answers
3k
views
Parallel processing a Tree on GPU
I have seen a few papers on parallel/GPU processing of trees, but after briefly looking through them I wasn't able to grasp what they did. The closest to a helpful explanation was found in ...
1
vote
1
answer
72
views
Efficiently determining available options based on prior selections
I'm looking for a known design pattern or algorithm that can be used to effectively determine a set of available options to be presented to a user based on previous decisions.
An extremely simple ...
3
votes
3
answers
577
views
What strategy should I follow to draw a forest of trees represented by an array
I have an array of integers representing connectivity of nodes.Consider the following states of the array after each time it's changed:
0|1|2|3|4|5|6|7|8|9 => Root of each node is itself
0|1|2|3|3|5|...
0
votes
1
answer
60
views
When should an expression tree hold pointers and when should it hold values of subexpressions?
I was thinking it should hold pointers:
struct Expr
{
string sym;
Expr*[] sub;
this(self, string sym) {
this.sym = sym;
}
@property auto dup() const {
auto e = ...
0
votes
1
answer
818
views
Why the search time for TreeSet is O(nlogn)?
In my naive opinion it should be O(n) in worst case since Tree could get spindly and unbalanced.
-1
votes
1
answer
70
views
How to fit k-length arrays to number of bigger arrays?
I have n number of one-dimensional arrays similar to:
[0,0,0,0,0,1,1,1,0,0,1,1,...]
0's and 1's indicating occupation.
And k number of smaller arrays similar to:
[2,2,2], [2,2], [2], [2,2,2,2]
...
0
votes
1
answer
777
views
Extract All Possible Paths from Expression-Tree and evaluate them to hold TRUE
This is a follow-up question of my previous one: https://stackoverflow.com/questions/38421950/better-class-structure-for-logical-expression-parsing-and-evaluation
Brief introduction:
rules as strings
...
2
votes
1
answer
267
views
Matrix multiplication range queries
I have a huge list of matrix i.e A = {M0, M1, M2 .. Mn}.
I have a task to find the product of all the matrices in a given range {x,y} i.e Mx * Mx+1 * Mx+2 ... * My.
I would like to know if there is ...
0
votes
2
answers
2k
views
Keeping track of the number of nodes in the subtree in black and red trees
I was wondering, if I have a black and red tree and I want to keep track of the number of nodes in the subtree, what is the most effective way to do so?
I mean how do I work with these values while ...