Postingan

Menampilkan postingan dari Mei, 2020

Heap (Max And Min) & Tries

Gambar
Heap Heap is a Tree Type data structure that has a complete set of nodes. Heaps are used in store array. What so special about Heaps is that every time we inserted value to it, it used its own  Algorithm to sort itself and the way of indexing them is through left to right nodes in every level. You can access a parent of the node by dividing their index by 2. Types of Heap  A. Max Heap In Max Heap Binary Tree, The parent of the node child holds a value that is greater than its child value. The Max Value of the Tree is located at the Root of the tree. B. Min Heap In Max Heap Binary Tree, The parent of the node child holds a value that is smaller than its child value. The Min Value of the Tree is located at the  Root  of the tree. Min Max Heap C. Min Max Heap Min Max Heap is a special case of Heap. It lets you build a tree structure that has an alternating structure where odd heights of the tree prioritize minimum value while the even heights prioritize m

AVL Tree

Gambar
AVL TREE AVL Tree (Adelson-Velsky & Landis Tree) adalah sebuah data struktur turunan dari data struktur tree yang dapat disebut juga sebuah self balancing binary tree  atau binary search tree yang memiliki kemampuan untuk menyeimbangkan dirinya. Maksud dari keseimbangan tree ini adalah perbedaan kedalaman dari tree yang dimaksud. Gambar diatas merupakan salah satu contoh dari AVL tree yang dimaksud. pada gambar tersebut, Binary Tree Search ini dapat dikatakan seimbang karena perbedaan pada jumlah subtree setiap root tidak lebih dari satu. Rotation Sebelum kita memasuki insertion dan deletion, ada baiknya kita terlebih dahulu memahami konsep rotation yang krusial untuk kedua langkah tersebut. Apa sebenarnya rotation itu? Rotation dalam konteks ini bisa dikatakan penggantian pointer dari node yang tidak seimbang dengan melakukan pemutaran node pada tree yang tidak seimbang. Insertion dan Deletion Untuk insertion, akan dilakukan pemasukan data seperti biasa pada BST,