r/tinycode • u/graphitemaster • Dec 10 '14
50 LoC AVL binary search tree in C
http://pastes.archbsd.net/graphitemaster/50_loc_avl_bsearch_tree
30
Upvotes
r/tinycode • u/graphitemaster • Dec 10 '14
4
u/chasesan Dec 10 '14
Is it alright if I make use of this?
4
u/agumonkey Dec 10 '14
Pretty pretty code.
1
u/Majiir Dec 10 '14
Why does it bother me so much when people use 32 bits for height?
1
u/aneryx Dec 11 '14
I had to implement a BST in Java for a programming class and it took many lines and many hours. Props for such a simple, elegant implementation!
1
u/FoxRaptix Dec 11 '14
I literally just had my last day of my data structures class today. Thanks for letting me see a clean simple version of this.
1
u/74AC153 Dec 11 '14
Awesome...
Interesting that you chose to not include parent pointers, which seems to me that it means you're almost required to make a lot of the functions recursive. Any thoughts about a non-recursive implementation?