Reputation: 2257
I've been trying to code and implement a B-Tree in C and unfortunately, I'm having some problems on insertion. And that is why I'd like to see other C implementation of a B-Tree.
The problem is, most implementation I found online is more on file IO/ database. I know that is the right way to do it, but do you know of a BTree impelementation on a console that is interactive? C only
Interactive by mean of this kind of output:
(Asks the user)
Tree Order: 3
Choose (I)nsert - (D)elete - (S)earch: I
Data: 5
and so on...
Thanks a lot!
Upvotes: 0
Views: 430
Reputation: 36
What you want is not an interactive B-Tree implementation indeed.
You are writing a B-Tree in C. Technically you are implementing an In-Memory B-Tree, so you need an well-implemented one to learn from. Try googling "in memory btree" to find your need.
Here is possibly one: "STX B+ Tree C++ Template Classes" http://idlebox.net/2007/stx-btree/. You can have one and write some small tests to insert one or several numbers and see what happening.
Upvotes: 1
Reputation: 13189
Code it as normal and run in a debugger. Set breakpoints where needed and use the ability to set and print variables to do console I/O.
Upvotes: 0