What is a List Tree?
It is a data structure that combinds the beauty of a Linked List and Binary Tree.
Why?
The linked-list and binary-tree components of List Tree complement eachother perfectly:
*Iterate through items in a sorted manner. (linked list)
*Search & add new items at logarithmic speed. (binary tree)
What does it look like?
Code:
struct ListTreeItem {
ListTreeItem *prev, *next; // linked list part
ListTreeItem *parent, *leftchild, *rightchild; // binary tree part
void* userdata; // placeholder
};
Background:
I need to implement a TimerManager for a preformance-critical project. My requierments are:
*Keep timers sorted by nearest-in-time -> Solution: linked list
*Add new timers without comparing from-begin-to-end -> Solution: binary tree
I appreciate any feedback. Is this implemented already or is there a better solution?
Cheers
/sincoder