Postingan

Menampilkan postingan dari Maret, 2018

Materi Pertemuan 6 Data Structure TREE & BINARY TREE

Gambar
MATERI PERTEMUAN 6 Tree & Binary Tree Binary tree A binary tree is a tree in which no node can have more than two children. Each node has an element, a reference to a left child and a reference to a right child. Type of Binary Tree ·        PERFECT binary tree is a binary tree in which every level are at the same depth. ·        COMPLETE binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible. A perfect binary tree is a complete binary tree. ·        SKEWED binary tree is a binary tree in which each node has at most one child. ·        BALANCED binary tree is a binary tree in which no leaf is much farther away from the root than any other leaf (different balancing scheme allows different definitions of “much farther”). Notes: materi lebih lengkap dapat d...

Materi pertemuan 5 Introduction to Tree, Binary Tree And Expression Tree

Gambar
Materi pertemuan 5 Introduction to Tree, Binary Tree And Expression Tree 1.    Tree       Tree defined recursively. A tree is a collection of nodes.   The collection can be empty; otherwise, a tree consists of a distinguished node r, called the root, and zero or more non-empty (sub) trees T 1 , T 2 , …, T k each of whose roots are connected by a directed edge from r. A tree is a collection of N nodes, one of which is the root and N-1 edges. Tree terminology ·        The root of each subtree is said to be a child of r and r is said to be the parent of each subtree root. ·        Leaves : nodes with no children (also known as external nodes) ·        Internal Nodes : nodes with children ·        Siblings : nodes with the same parent ·        A path from node n 1 to n k is defi...
Materi Pertemuan 4 COMP6048– DATA STRUCTURE  Linked List Implementation II  ·     Stack Stack adalah struktur data penting yang menyimpan unsur-unsurnya secara teratur. ·       Analogi: Anda pasti pernah melihat setumpuk piring tempat piring diletakkan di atas yang lain. Bila Anda ingin melepaskan piring, Anda melepaskan piring paling atas terlebih dahulu. Oleh karena itu, Anda dapat menambahkan dan menghapus elemen (yaitu pelat) hanya di / dari satu posisi yang merupakan posisi paling atas. ·       Stack Concept Stack adalah struktur data linear yang dapat diimplementasikan dengan baik menggunakan array atau linked list. Elemen dalam tumpukan ditambahkan dan dihapus hanya dari satu ujung, yang disebut bagian atas. Data disimpan dalam cara Last In First Out (LIFO). ·       Array Representation 1.     Stack memiliki dua variabel: ...