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.

2 votes
0 answers
55 views

Higher-order procedures for tree manipulation in SICP

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
54 views

STL style iterator template for arbitrary trees in C++20

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
82 views

Numba implementation of AA Tree with rank and select operations

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
761 views

Optimal Algorithm to Append and Access Tree Data

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
6 votes
1 answer
108 views

Fast and low Memory Requiring Lookup Tree Library

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
2 votes
1 answer
74 views

Schedule using binary tree in C

I'm trying to organize the code according to the run menu of a schedule using the binary tree data structure because if I search for a user, the menu always appears first, and the listed user is left ...
user avatar
2 votes
0 answers
105 views

Rust implementation of a BTree

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
119 views

Making sklearn's decision trees easier to traverse

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
465 views

Leetcode: Largest Number

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
  • 361
2 votes
2 answers
674 views

Binary tree deepcopy using the Morris traversal in C

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
1 vote
3 answers
142 views

Maximum Sum BST in a Binary Tree

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
959 views

Simple tree dictionary structure in C

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
94 views

Semi-dynamic range minimum query (RMQ) tree in Java

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
  • 30.2k
3 votes
0 answers
53 views

Assign unique identifiers to binary matrices using a binary tree

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
84 views

Hashing a fixed size binary stream with a tree structure in Rust

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