I realise that a binary tree is by definition a recursive data structure but I would like to do it iteratively. Well at least Insert, Search and Delete. Has anybody done this?
I did it in Pascal but I am having trouble converting the code into C.
I realise that a binary tree is by definition a recursive data structure but I would like to do it iteratively. Well at least Insert, Search and Delete. Has anybody done this?
I did it in Pascal but I am having trouble converting the code into C.
As in
while ( p ) p = p->left;
and variations on ->left and ->right for traversing the tree.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Yes, that's it.