Skip to main content

Posts

Showing posts from May, 2020

AVL dan B-Tree

AVL TREE In Computer Science term an AVL tree is a type of self-balancing binary tree. The word AVL come from it's inventor  A delson- V elsky and  L andis. It's the first of such Data Structure. The term self-balancing mean that an AVL tree will maintain both of it's subtree height so that their height diffenrence will be 1, -1, or 0. This is called the balance facotr of an AVL tree. Basically an AVL tree is like an Binary Search Tree but with an self-balancing function built into it.  Why Use an AVL Tree The reasoning to why we must balance the tree if it's not balanced is so that the time complexity for the operation (Search, Insert, Delete) will always be at O(log n) instead of the usual O(h) (where h is the height of the tree ) for the worst case scenario.  Example of a skewed tree For the tree above say that we want to search for the node 74 that we have to traverse the entire tree to find said note but if it's an AVL tree then We on...