Questions tagged [binary-search-tree]
The binary-search-tree tag has no summary.
42 questions
6
votes
2
answers
500
views
Implementation of a balanced binary tree
I never remember without looking how to write RB or AVL balancing.
but I wanted to make sure I would be able to still write a reasonable dynamically balanced binary tree. If it is asked of me in ...
4
votes
1
answer
208
views
Weight balanced tree in OCaml
The objective was to create a weight-balanced binary search tree with a well-defined interface. Any critiques or suggestions for improvement are welcome.
...
5
votes
4
answers
783
views
Reservation app in C with linked list, BST, and CSV
This is a reservations app with linked lists for insertion and BST for search.
It uses CSV files for storage, recursion for printing
and handles memory allocation for variable growth.
I'm looking for ...
2
votes
1
answer
103
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 ...
2
votes
2
answers
118
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 ...
2
votes
3
answers
178
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 ...
2
votes
1
answer
117
views
Sort array of numbers using tree sort - Leetcode 912
Problem statement:
Sort integer array nums in O(N log N) time,
without relying on any library sort routine.
I am trying to use a tree sort method (using the ...
4
votes
2
answers
155
views
Delete a node in binary tree
Problem Statement
Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.
Basically, the deletion ...
-2
votes
1
answer
104
views
Market Portfolio Binary Search Tree [closed]
I'm trying to solve the following problem here:
First line of input contains the number of days D. The next d lines contains a character c and a number x. If c is B, then buy stock . If c is S, then ...
2
votes
2
answers
157
views
Binary search tree with Iterators
One more BST implementation with iterators added. Did not manage to find another implementation with iterators and it is my first attempt at implementing them so thought to check on your opinion:
<...
6
votes
2
answers
2k
views
Avoiding memory leaks and using pointers the right way in my binary search tree implementation - C++
I'm learning C++ and I wanted to test my knowledge by implementing a Binary Search Tree using struct (I know, I’m using C++ I should use classes but I want to keep ...
7
votes
2
answers
1k
views
Pet Shelter in C++
The provided code represents an implementation of a Binary Search Tree (BST) in C++, specifically tailored for a "Pet ...
3
votes
1
answer
57
views
Convert sorted list to BST
I am working on a Daily Coding Challenge to convert a sorted singly-linked list into a binary search tree.
We are given the head of the list; the definitions of ...
5
votes
2
answers
259
views
Binary Search Tree implementation in C [1]
I have tried to implement my Binary Search Tree in C. The following are the 18 operations defined:
create a bst
is_empty
insert
delete
clear
find
find_min
find_max
height
size
depth
level order ...
4
votes
2
answers
202
views
Max Stack implementation in C++ involving iterators
The tricky thing was keeping copies of list iterators in a tree map and managing both together. I'm not handling invalid input cases (like popping an empty stack) in this code. I am following Google C+...