All Questions
55 questions
2
votes
1
answer
88
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
2
answers
686
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 ...
8
votes
3
answers
993
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 ...
3
votes
1
answer
121
views
AVL Tree in C Criticism
I have made an AVL tree in C and coded the basic functionality of insertion, deletion, and search. I would love some criticism on my implementation especially on the insertion and deletion section of ...
3
votes
1
answer
61
views
Counting unival subtrees - Follow Up
This code is a revised version of the implementation which asked for an advice on improvement. Original post here: Counting unival subtrees
Credits to: [Deduplicator], [Reinderien], [Toby Speight], [...
5
votes
1
answer
277
views
Implementing an autocomplete system
Question:
Implement an autocomplete system. That is, given a query string s and a set of all possible query strings, return all strings in the set that have s as a prefix.
For example, given the query ...
1
vote
1
answer
159
views
Slow insertion into a Red Black tree
I am trying to implement a red black tree. The problem is that the code runs slowly and I wonder if I did something wrong or just did it too many times. I already checked and the problem is in the ...
12
votes
3
answers
5k
views
Huffman tree compressing/decompressing in C
In a past course one of the assignments was to write a program that can compress files using Huffman Tree algorithm, and uncompress the files that the program generates.
My design is to count the ...
1
vote
2
answers
133
views
Unbalanced Binary Search Tree insertion and search with random and sorted values
I have created this unbalanced binary search tree in C. Can anyone say this is a true approach or not? I have two scenarios for insertion and search: in the first scenario I am inserting 10000 random ...
7
votes
1
answer
2k
views
Red-black tree in C
I would like to verify that the code fulfills the specification of a red-black tree or receive suggestions for improvements.
...
4
votes
1
answer
2k
views
B-Tree implementation in secondary-memory/disk-memory
I will start by saying this implementation was based on the approach taken with B-Trees in the book:
Introduction to Algorithms, 3rd Edition - Cormen, 2011
The implementation stores all the b-tree ...
5
votes
1
answer
310
views
Inserting into a binary expression tree with GOTO
I'm working on a binary space partition tree.
For the time being, the nodes are only inserted into the right. A node that has children will have 0 as data. Here are the insertion rules.
If the ...
1
vote
2
answers
111
views
Search Tree in C
I started working on an implementation for a BST, just for myself to have some C projects. this is what I've done so far.
tree.h
...
8
votes
1
answer
556
views
C - fully threaded binary search trees
For learning purposes, I've decided to implement several classic data structures, starting with binary search trees. The entire code can be seen here, in a frozen branch ...
4
votes
2
answers
2k
views
Binary Tree in C
It takes integers from argv[] and inserts into tree, making sure to allocate memory and free that memory once the program has finished. How can I improve code quality, what are your suggestions?
<...