You are on page 1of 13

KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

Nama Kelompok 5

1. Adan Ramadhani (1915016146)


2. Aqmal Xandiva Ramadya (1915016136)
3. Khoirun Ummat (1915016102)
4. Sahrani (1915016135)

1. General Instructional Objectives


a. a. Students can design applications using the Linked List structure
b. b. Students are able to perform analysis on the Single & Doube Linked List algorithm
that is created
c. c. Students are able to implement the Single & Double Linked List algorithm in an
application appropriately and efficiently

1. Tujuan Instruksional Umum


a. Mahasiswa dapat melakukan perancangan aplikasi menggunakan struktur Linked
List
b. Mahasiswa mampu melakukan analisis pada algoritma Single & Doube Linked
List yang dibuat
c. Mahasiswa mampu mengimplementasikan algoritma singe & Double Linked List
pada sebuah aplikasi secara tepat dan efisien

2. Specific Instructional Objectives


a. Students can explain about Single & Double Linked List
b. Students can create and declare a Single & Double Linked List Data Type
Abstraction
c. Students are able to apply Single Linked List Non Circular & Single Linked List
Circular operation
d. Students are able to apply Double Linked List Non Circular & Double Linked List
Circular

1
KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

2. Tujuan Instruksional Khusus


a. Mahasiswa dapat menjelaskan mengenai Single & Double Linked List
b. Mahasiswa dapat membuat dan mendeklarasikan Abstraksi Tipe Data Single
& Double Linked List
c. Mahasiswa mampu menerapkan operasi Single Linked List Non Circular &
Single Linked List Circular
d. Mahasiswa mampu menerapkan Double Linked List Non Circular & Double
Linked List Circular

3. Definition of Linked List


Linked List or also known as a chain list is a data structure consisting of a
sequence of data records where each record has a field that stores the address /
reference of the next record (in sequence). Data elements that are linked by links on
the Linked List are called Nodes.

3. Pengertian Linked List


Linked List atau dikenal juga dengan sebutan senarai berantai adalah struktur data
yang terdiri dari urutan record data dimana setiap record memiliki field yang
menyimpan alamat/referensi dari record selanjutnya (dalam urutan). Elemen data
yang dihubungkan dengan link pada Linked List disebut Node.

There are several kinds of Linked List, namely:

A. Single Linked List

Single Linked List (SLLC) is a linked list that has only one pointer
variable. Where the pointer points to the next node. Usually the tail field
points to NULL.

Definition:

2
KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

• Single: means that the field pointer is only one and one direction.

• Linked List: means that the nodes are connected to each other.

• Circular: means that the next pointer will point to itself so that it rotates

Example :

Ilustrasi SLLC :

Each node in the linked list has a field that contains a pointer to the
next node, and also has a field that contains data.

At the end of the linked list, the last node points to the leading node so
that the linked list rotates.

The node declaration is made from the following struct:

typedef struct TNode {

int data;

3
KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

TNode * next;

};

Ada beberapa macam Linked List, yaitu :


A. Single Linked List (Senarai berkaitan tunggal)
Single Linked List (SLLC) merupakan suatu linked list yang hanya memiliki
satu variabel pointer saja. Dimana pointer tersebut menunjuk ke node selanjutnya.
Biasanya field pada tail menunjuk ke NULL.
Pengertian:
 Single : artinya field pointer-nya hanya satu buah saja dan satu arah.
 Linked List : artinya node-node tersebut saling terhubung satu sama lain.
 Circular : artinya pointer next-nya akan menunjuk pada dirinya sendiri sehingga
berputar
Contoh :

Ilustrasi SLLC :

4
KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

Setiap node pada linked list mempunyai field yang berisi pointer ke
node berikutnya, dan juga memiliki field yang berisi data.
Pada akhir linked list, node terakhir akan menunjuk ke node terdepan
sehingga linked list tersebut berputar.

Deklarasi node dibuat dari struct berikut ini:


typedef struct TNode{
int data;
TNode *next;
};
B. Double Linked List
It is a linked list that has two pointer variables, namely a pointer that
points to the next node and a pointer that points to the previous node. Each
head and tail also points to NULL. Example:
examples of codingan:

struct Student {
char name [25];
int age;
struct Student * next, * prev;
} * head, * tail;

B. Double Linked List


Merupakan suatu linked list yang memiliki dua variabel pointer yaitu
pointer yang menunjuk ke node selanjutnya dan pointer yang menunjuk ke
node sebelumnya. Setiap head dan tailnya juga menunjuk ke NULL. Contoh :

5
KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

contoh codingannya :
struct Mahasiwa{
char nama[25];
int usia;
struct Mahasiswa *next,*prev;
}*head,*tail;
C. Circular Linked List
It is a linked list where tail (last node) points to head (first node). So
there is no pointer that points to NULL. There are 2 types of Circular Linked
List, namely:
C. Circular Linked List
Merupakan suatu linked list dimana tail (node terakhir) menunjuk ke
head (node pertama). Jadi tidak ada pointer yang menunjuk NULL. Ada 2
jenis Circular Linked List, yaitu :

a. Circular Single Linked List


Almost the same as the Singly Linked List, except that the last node will
be connected to the first node so that it is circular. Declarations and operations in
the Singly Linked List also apply to the Circular Singly Linked List, what needs to
be taken care of is that the last node must always be connected to the first node
pointed to by Head. Example:

6
KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

a. Circular Single Linked List


Hampir sama dengan Singly Linked List, hanya saja simpul terakhir akan
dihubungkan ke simpul pertama sehingga berbentuk melingkar. Pendeklarasian
dan operasi yang ada di Singly Linked List juga berlaku di Circular Singly Linked
List, yang perlu dijaga adalah bahwa simpul terakhir harus selalu terhubung ke
simpul pertama yang ditunjuk oleh Head. Contoh :

b. Circular Double Linked List


Double Linked Circular List (DLLC) is a linked list with
using a pointer, where each node has 3 fields, namely 1 field pointer that points to
the next pointer, 1 field points to the previous pointer (prev), and a field that
contains data for that node with the next and pre pointers pointing to itself itself
circularly.

b. Circular Double Linked List


Double Linked List Circular (DLLC) adalah linked list dengan
menggunakan pointer, dimana setiap node memiliki 3 field, yaitu 1 field pointer
yang menunjuk pointer berikutnya (next), 1 field menunjuk pointer sebelumnya
(prev), serta sebuah field yang berisi data untuk node tersebut dengan pointer next
dan pre-nya menunjuk ke dirinya sendiri secara circular.

7
KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

D. Multiple Linked List


It is a linked list that has more than 2 pointer variables.

D. Multiple Linked List


Merupakan suatu linked list yang memiliki lebih dar 2 buat variabel pointer.

4. Priority Queue
Priority Queue is similar to the regular queue which was described in the previously
posted Array, Pointer and Data Structure. It's just that this queue is sorted by priority.
For example, we want to create a queue based on age from youngest to oldest. Then
age becomes a priority. Arranging these nodes may be similar to sorting.
• Prefix is a writing method by placing the operator in front of the operand and
without brackets.
Examples of using a prefix are + AB, - + ABC, * + AB - CD.

8
KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

• Infix is a way of writing expressions by placing an operator between two


operands, in this case the use of brackets determines the result of the operation.
Examples of using infix are A + B, A + B-C, (A + B) * (C-D).
• Postfix is a writing method by writing the operator after the operand and without
brackets.

4. Priority Queue
Priority Queue mirip dengan queue biasa yang telah dijelaskan pada Array,
Pointer dan Struktur Data yang dipost sebelumnya. Hanya saja queue ini di urutkan
berdasarkan prioritasnya. Misalnya kita ingin membuat queue berdasarkan umur yang
paling muda ke tua. Maka umur menjadi prioritas. Penyusunan node ini mungkin
mirip seperti sorting.
 Prefix adalah metode penulisan dengan meletakkan operator di depan operand
dan tanpa menuliskan tanda kurung.
Contoh pemakaian prefix adalah +AB, – +ABC, * + AB – CD.
 Infix adalah cara penulisan ungkapan dengan meletakkan operator di antara dua
operanddalam hal ini pemakaian tanda kurung sangat menentukan hasil operasi.
Contoh pemakaian infix adalah A+B, A+B-C, (A+B)*(C-D).
 Postfix adalah metode penulisan dengan menuliskan operator setelah operand dan
tanpa menuliskan tanda kurung.

4. Linked List operations


a. Insert
The term Insert means adding a new node to a linked list.
b. IsEmpty
This function determines whether the linked list is empty or not.
c. Find First
This function looks for the first element of the linked list.

9
KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

d. Find Next
This function looks for the element after the element pointed to now.
e. Retrieve
This function takes the element pointed to by now. The element is then returned
by the function.
f. Update
This function changes the element pointed to by now with the content of
something.
g. Delete Now
This function removes the element pointed to by now. If you delete the first
element of the linked list (head), head will move to the next element.
h. Delete Head
This function removes the element the head points to. The head moves to the next
element.
i. Clear
This function deletes an existing linked list. This function is mandatory if you
want to end a program that uses a linked list. If you do this, the data that was
allocated to the memory in the previous program will remain in the memory.

5. Operasi-operasi Linked List


a) Insert
Istilah Insert berarti menambahkan sebuah simpul baru ke dalam suatu linked list.
b) IsEmpty
Fungsi ini menentukan apakah linked list kosong atau tidak.
c) Find First
Fungsi ini mencari elemen pertama dari linked list.
d) Find Next
Fungsi ini mencari elemen sesudah elemen yang ditunjuk now.
e) Retrieve

10
KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

Fungsi ini mengambil elemen yang ditunjuk oleh now. Elemen tersebut lalu
dikembalikan oleh fungsi.
f) Update
Fungsi ini mengubah elemen yang ditunjuk oleh now dengan isi dari sesuatu.
g) Delete Now
Fungsi ini menghapus elemen yang ditunjuk oleh now. Jika yang dihapus adalah
elemen pertama dari linked list (head), head akan berpindah ke elemen berikutnya.
h) Delete Head
Fungsi ini menghapus elemen yang ditunjuk head. Head berpindah ke elemen
sesudahnya.
i) Clear
Fungsi ini menghapus linked list yang sudah ada. Fungsi ini wajib dilakukan bila
anda ingin mengakhiri program yang menggunakan linked list. Jika anda
melakukannya, data-data yang dialokasikan ke memori pada program sebelumnya
akan tetap tertinggal di dalam memori.
6. Differences Array with Linked List
A. ARRAY
Variable of type array is a data type that is static (order and size is certain). The
disadvantage of static arrays is that the used memory space cannot be deleted if the
array variable names are no longer used in a program (cause of redundancy). To solve
it, dynamic data structures are used using dynamic variables. Dynamic variables
cannot be declared explicitly like static variables and cannot be designated by
identifiers directly, but can be designated specifically by dynamic variables, namely
POINTER.

B. LINKED LIST
 This structure consists of a series of interconnected / related elements, where each
element is connected to other elements by a pointer.

11
KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

 Pointer, a cell whose value is the address of another cell where the other cell can
be data or a pointer as well
 Every element in the linked list always contains a pointer

6. Perbedaan Array dengan Linked List


A. ARRAY
Variable bertipe array adalah suatu tipe data yang bersifat statis (urutan dan ukuran
sudah pasti). Kelemahan dari array statis adalah penggunaan ruang memori yang
sudah digunakan tidak dapat dihapus apabila nama variable array tersebut sudah tidak
digunakan kembali dalam suatu program (penyebab kemubaziran). Untuk
pemecahannya maka digunakan struktur data dinamis dengan menggunakan variable
dinamis. Variabel dinamis tidak dapat dideklarasikan secara eksplisit seperti halnya
variable statis dan tidak dapat ditunjuk oleh identifier secara langsung, tetapi dapat
ditunjuk secara khusus oleh variable dinamis yaitu POINTER.

B. LINKED LIST
 Struktur ini terdiri dari rangkaian elemen yang saling berhubungan / berkaitan,
dimana setiap elemen dihubungkan dengan elemen lainnya oleh sebuah pointer.
 Pointer, sel yang nilainya merupakan alamat sel yang lain dimana sel yang lain itu
dapat berupa data atau berupa pointer juga
 Setiap elemen dalam linked list selalu berisi pointer

Linked list terms:


 A knot, consisting of two parts:
a) Section / field data (info)
b) Section / joint field (pointer that points to the next conclusion)
 Initial (First), the variable containing the address which designates the location of
the first node of the linked list

12
KELOMPOK 5 (Chapter 6: LINKED STRUCTURES)

 Nil / Null, not valuable, that is, states do not refer to any address.
 End, a node that points to the last node

Istilah – istilah pada linked list :


 Simpul, terdiri dari dua bagian :
a. Bagian/medan data (info)
b. Bagian/medan sambungan (pointer yang menunjuk kesimpul berikutnya)
 Awal (First), variable yang berisi alamat yang menunjuk lokasi simpul pertama
linked list
 Nil / Null, Tidak bernilai yaitu menyatakan tidak mengacu kealamat manapun.
 Akhir, sebuah simpul yang menunjuk pada simpul terakhir

13

You might also like