Skip to main content

Questions tagged [tree]

A tree is a graph in which there is exactly one path between any two nodes. It is often used as a hierarchical data structure.

5 votes
2 answers
470 views

For another project of mine, I decided that it would be handy to have a tree structure to dictate hierarchy between pieces of data, but I didn't want to unnecessarily keep that data alive if it would ...
BetterBuiltFool's user avatar
2 votes
0 answers
77 views

I'm working my way through Structure and Interpretation of Computer Programs and got to exercises 2.27-2.28, reproduced here: Exercise 2.27. Modify your reverse procedure of exercise 2.18 to produce ...
Luke's user avatar
  • 21
6 votes
2 answers
84 views

In different code bases I regularly encounter tree data structures of different design and usually need to traverse it at some point. I finally got tired of writing yet another iterative traversal by ...
besc's user avatar
  • 163
2 votes
1 answer
103 views

I've implemented an AA Tree (a type of self-balancing binary search tree) using Numba, a just-in-time compiler for Python. This implementation includes rank and select operations, which are useful for ...
Krosvick's user avatar
7 votes
3 answers
785 views

I have been studying intermediate or more advanced data structures in Python, one of which I've decided to try out is the Tree Data Structure. I've been studying the theories as well as the ...
Raphael Irvin's user avatar
5 votes
1 answer
134 views

Background While working on solving the end game of the russian card game Durak I developed a library small_memory_tree to store the simulation results. You can try the game on my website Modern Durak ...
Koronis Neilos's user avatar
1 vote
0 answers
128 views

I'm studying rust, and I decided to implement a BTree as a way of learning the language. Can anyone give me suggestions on the code? As the language has no inheritance, and we must replace it with ...
Lucas Paixão's user avatar
5 votes
1 answer
145 views

scikit-learn's decision tree structure is difficult for me to navigate. I would prefer to have functionality like tree.left, ...
Steven Gubkin's user avatar
6 votes
3 answers
552 views

I was trying out leetcode's Largest Number. As per the challenge's description: Given a list of non-negative integers nums, arrange them such that they form the largest number and return it. Since ...
ccot's user avatar
  • 351
2 votes
2 answers
704 views

I need to perform a deep copy of a binary tree using the Morris traversal. I think I managed to do it, that is the code below returns what I expect; however, I am not 100% sure I have covered every ...
Slav's user avatar
  • 121
2 votes
3 answers
178 views

I was trying to find the Maximum sum BST of a binary tree on LeetCode. While the Java code I have come up with, mostly seems right and is able to pass 55 out of the given 59 test cases too, the error ...
Siddharth Garg's user avatar
8 votes
3 answers
1k views

I have developed a C library whose goal is to store strings in an easily searchable tree structure (which I have dubbed tree-dictionary). I come from a math background and I have been coding in Python ...
francescoriccardocrescenzi's user avatar
2 votes
1 answer
108 views

Introduction I have this semi-dynamic range minimum query (RMQ) tree in Java. It is called semi-dynamic due to the fact that it cannot be modified after it is constructed. However, the values ...
coderodde's user avatar
  • 32.3k
3 votes
0 answers
67 views

Context I want to build a transposition table where the game states are binary square matrices which size MATRIX_SIZE is known at compile time. Rather than storing ...
Tristan Nemoz's user avatar
4 votes
1 answer
95 views

For a research project, I want to assign a unique identifier to a stream of bits. I can assume that all the streams will always have the same size. Because of this nice property, my idea has been to ...
Tristan Nemoz's user avatar

15 30 50 per page
1
2 3 4 5
60