An AVL tree is a binary search tree(BST) however, unlike binary search trees, an AVL tree (named after Georgy Adelson-Velsky and Evgenii Landis) is self balancing. So no matter how many nodes you insert into the tree, it will adjust it’s branches and ensure the tree is balanced at all times. Making sure the subtree heights only differ by at most 1. […]
Here is a short insert on how to remove all Nodes of X value from a list. I use recursion and I believe I’ve created a pretty clean solution. This requires Nodes found in my earlier post. Let me know if you have any comments or improvements!
Here is an example of a simple List class I wrote. Follow the comments to understand what is going on. This uses the node structure I wrote about here. Best of luck!
Okay the sequential search is easier than the recursive and iterative binary searches, I figure I would include it to wrap up searches for now. For the sequential search, you loop through an array (or whatever data structure you are using) checking each position for the search value. Works just as well on sorted array lists as it does on unsorted array […]
So yesterday’s post was on how to do a recursive binary search, today is looking at performing the exact same search on an array but doing it iteratively. So instead of calling a function over and over and over again, we will use a loop. Again, this search is best on a sorted array. The search function takes in an […]
I wrote a recursive binary find that looks through a sorted array for a given number. (You can use this on an unsorted array, it just isn’t as performant.) This is how it works, the recursive function call requires the number to search and the lowest and highest positions in a search range. To start, you give the low position, 0, […]