Selasa, 19 Mei 2020

Heap and Tries

Michael Albert Purnama
2301877716

Heap
Heap adalah complete binary tree (bukan binary search tree) yang mempunyai properties sebagai berikut:
  • Min Heap
    • Setiap node lebih kecil dari masing-masing childnya
    • Root merupakan node paling kecil, sedangkan node terbesar terletak pada leaf node


  • Max Heap
    • Setiap node lebih besar dari masing-masing childnya
    • Root merupakan node paling besar, sedangkan node terkecil terletak pada leaf node


Image result for Max Heap
  • Min-Max Heap
    • Heap dengan Min heap pada level ganjil dan Max heap pada level genap
Image result for Min max heap
TRIES

Tries (prefix tree) adalah ordered tree data structure yang digunakan untuk menyimpan array asosiatif (biasanya string)

TRIE berasal dari kata reTRIEval, karena TRIES dapat menemukan satu kata dalam kamus dengan hanya awalan kata.

Contoh TRIES : 



Jumat, 01 Mei 2020

AVL


Michael Albert Purnama
2301877716


AVL tree is a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees cannot be more than one for all nodes.


The above tree is AVL because differences between heights of left and right subtrees for every node is less than or equal to 1.

ini bukan AVL karena perbedaan tinggi di kiri dan kanannya lebih dari 1