Posts

Showing posts from March, 2020
Image
Double Linked List (DLL) Double Linked List is simliar to Single Linked List, the different is that instead of one pointer, Double Linked List as the name suggested possess 2 pointer instead of one, where the other point can point backward too in addition to pointing forward to the next value. Double Linked List code example : /* Node of a doubly linked list */ struct Node { int data; struct Node* next; // Pointer to next node in DLL struct Node* prev; // Pointer to previous node in DLL }; Advantage over Single Linked List : Advantages over singly linked list 1. A DLL can be traversed in both forward and backward direction. 2.  The delete operation in DLL is more efficient if pointer to the node to be deleted is given. 3,   We can quickly insert a new node before a given node. In singly linked list, to delete a node, pointer to the previous node is needed. To get this previous node, sometimes the list is traversed. In DLL, we can get the previo...
Image
Hash Table and Binary Search Tree Hash table is a structure data which consist of table and function aiming to map unique key value from each record to hash, the record location is located within the table. Hash Operation consist of : Insert : Insert a value into the table Find : Search a value in the table Remove : Delete a value in the table GetIterator : Return Iterator which check all value one by one. The hash table uses an associative array data structure that associates a record with a unique key field in the form of a number (Hash) which is a representation of that record. For example, there is data in the form of a string to be stored in a hash table. The string is represented in a key field K. The way to get this key field varies greatly, but the end result is a hash number that is used to determine the location of a record. This hash number is entered into the hash function and produces a record location index in the table.           ...

Push Linked List

Single Linked List Apa itu Push? Push adalah action memasukan suatu inputan ke dalam List, push diawali dengan membuat gerbong nya terlebih dahulu dimana gerbong ini akan diisi oleh inputan dan jumlah nya disesuai kan dengan memory alokasi yang kita butuhkan, nah setelah gerbong tersedia, baru lah kita dapat melakukan Push. Ada berapa type Push? Push memiliki 3 type : Depan, Belakang, dan Tengah. Push depan adalah Push dimana inputan dimasukan tepat di depan head, setelah inputan diletakan di depan head, inputan tersebut disambungkan dengan inputan belakang nya dan menjadi head yang baru. Push belakang adalah Push dimana inputan dimasukan tepat di belakang tail, setelah inputan diletakan di belakang tail, inputan tersebut disambungkan dengan inputan didepan nya dan menjadi tail yang baru. Push tengah adalah Push dimana inputan dimasukan diantara posisi head dan tail, untuk mengetahui dengan pasti posisi inputan maka dilakukan proses sorting terlebih dahulu, diman...