Posts

Showing posts from February, 2020

Linked List

Image
Linked List atau Senarai Berantai adalah data berbentuk urutan di mana setiap record data memiliki referensi ke data berikutnya. Elemen data yang dihubungkan dengan link pada linked list disebut Node. Dalam Linked List, terdapat istilah head dan tail. Head merupakan elemen yang berada pada posisi pertama. Tail merupakan elemen yang berada pada posisi terakhir. A. SINGLE LINKED LIST Single Linked List hanya memiliki satu pointer saja. Pointer tersebut menunjuk ke node selanjutnya, dan field pada tail menunjuk ke NULL. Contoh : Contoh Coding : struct Siswa{   char Nama[30];   int Umur;   struct Siswa *next; }*head, *tail; B. DOUBLE LINKED LIST Double Linked List memiliki dua pointer, yaitu pointer yang menunjuk ke node selanjutnya dan pointer yang menunjuk ke node sebelumnya. Pada Double Linked List, setiap head dan tailnya menunjuk ke NULL. Contoh : Contoh Coding : struct Siswa{   char Nama[30];   int Umur;   struct Siswa ...

Linked List

Linked list is a linear data structure, consists of nodes where each node contains a data field and a reference to the next node in the list. It is used in many algorithms for solving real-time problems, when the number of elements to be stored is unpredictable and also during sequential access of elements. Linked list allows insertion and deletion of any element at any location. There are two types of linked list, Single Linked List and Double Linked List. Circular single linked list is a type of data structure that is made up of nodes that are created using self referential structures. Each of these nodes contain two parts, namely the data and the reference to the next list node. Only the reference to the first list node is required to access the whole linked list. This is known as the head. The last node in the list points to head or first node of the list. That is the reason this is known as a circular linked list. In circular, last node contains a pointer to the first node. ...