0% menganggap dokumen ini bermanfaat (0 suara)
191 tayangan64 halaman

Praktikum Linked List

Linked list adalah struktur data yang terdiri dari simpul-simpul yang saling terhubung secara linier melalui pointer. Terdapat beberapa jenis linked list seperti single linked list, double linked list, serta variasi circular dan non-circular.

Diunggah oleh

ridwantaufik0544
Hak Cipta
© © All Rights Reserved
Kami menangani hak cipta konten dengan serius. Jika Anda merasa konten ini milik Anda, ajukan klaim di sini.
Format Tersedia
Unduh sebagai PPTX, PDF, TXT atau baca online di Scribd
0% menganggap dokumen ini bermanfaat (0 suara)
191 tayangan64 halaman

Praktikum Linked List

Linked list adalah struktur data yang terdiri dari simpul-simpul yang saling terhubung secara linier melalui pointer. Terdapat beberapa jenis linked list seperti single linked list, double linked list, serta variasi circular dan non-circular.

Diunggah oleh

ridwantaufik0544
Hak Cipta
© © All Rights Reserved
Kami menangani hak cipta konten dengan serius. Jika Anda merasa konten ini milik Anda, ajukan klaim di sini.
Format Tersedia
Unduh sebagai PPTX, PDF, TXT atau baca online di Scribd
Anda di halaman 1/ 64

{

Introduction to
Java Programming
for High School
< Here is where your presentation begins >

... }
Our team

{ ..
*
Siti safhira Ridwan Taufik

.. }
Pengertian linked list
Salah satu bentuk struktur data yang berisi kumpulan data yang tersusun secara sekuensial, saling
bersambungan, dinamis dan terbatas adalah senarai berkait (linked list). Suatu senarai berkait (linked
list) adalah suatu simpul (node) yang dikaitkan dengan simpul yang lain dalam suatu urutan tertentu.
Suatu simpul dapat berbentuk suatu struktur atau class.
Simpul harus mempunyai satu atau lebih elemen struktur atau class yang berisi data. Secara teori, linked
list adalah sejumlah node yang dihubungkan secara linier dengan bantuan pointer.
Senarai berkait lebih efisien di dalam melaksanakan penyisipan-penyisipan dan penghapusan-
penghapusan. Senarai berkait juga menggunakan alokasi penyimpanan secara dinamis, yang merupakan
penyimpanan yang dialokasikan pada runtime.
Pengertian linked list
Dalam menghubungkan setiap node, kita dapat menggunakan cara first-create-first-access ataupun
first-create-lastaccess. Yang berbeda dengan deklarasi struct sebelumnya adalah satu field bernama
next, yang bertipe struct tnode. Hal ini sekilas dapat membingungkan. Namun, satu hal yang jelas,
variabel next ini akan menghubungkan kita dengan node di sebelah kita, yang juga bertipe struct
tnode. Hal inilah yang menyebabkan next harus bertipe struct tnode.
Karena di dalam banyak aplikasi, ukuran dari data itu tidak diketahui pada saat kompile, hal ini bisa
merupakan suatu atribut yang baik juga. Setiap node akan berbentuk struct dan memiliki satu buah
field bertipe struct yang sama, yang berfungsi sebagai pointer.
Bentuk Umum :
typedeft struct telemtlist
{
infotype info;
address next;
}elmtlist;
infotype -> sebuah tipe terdefinisi yang menyimpan informasi sebuah elemen list
next -> address dari elemen berikutnya (suksesor). Jika L adalah list, dan P adalah address, maka
alamat elemen pertama list L dapat diacu dengan notasi : first (L)
Sebelum digunakan harus dideklarasikan terlebih dahulu :
#define First(L) (L)
Elemen yang diacu oleh P dapat dikonsultasi informasinya dengan notasi :
info(P)deklarasi #define info(P) P->info
next(P)deklarasi #define next(P) P->next
Beberapa Definisi:

01 List l adalah list kosong, jika First(L) =


Nil
02 Elemen terakhir dikenali, dengan salah satu cara
adalah karena Next(Last) = Nil

Nil adalah pengganti Null, perubahan ini dituliskan dengan


#define Nil Null
Operasi-operasi Linked list

Insert IsEmpty
Istilah Insert berarti menambahkan Fungsi ini menentukan apakah
sebuah simpul baru ke dalam suatu linked list kosong atau tidak.
linked list.

Find First Find Next


Fungsi ini mencari elemen Fungsi ini mencari elemen
pertama dari linked list sesudah elemen yang ditunjuk
now.
Operasi-operasi Linked list

Retrieve Update
Fungsi ini mengambil elemen yang Fungsi ini mengubah elemen
ditunjuk oleh now. Elemen tersebut yang ditunjuk oleh now dengan
lalu dikembalikan oleh fungsi. isi dari sesuatu.

Delete Now Delete Head


Fungsi ini menghapus elemen yang ditunjuk
Fungsi ini menghapus elemen
oleh now. Jika yang dihapus adalah elemen
yang ditunjuk head. Head
pertama dari linked list (head), head akan
berpindah ke elemen
berpindah ke elemen berikutnya
sesudahnya.
Operasi-operasi Linked list

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.
Jenis-jenis linked }
list!
1. Single Linked List (Senarai berkait tunggal)
1) Single Linked List non Circular
2) Single Linked List Circular
2. Double Linked List (Senarai berkait ganda)
1) Double Linked List non Circular
2) Double Linked List Circular

}
Single Linked List (senarai berkait
tunggal)
{ Single linked list adalah apabila hanya ada satu pointer yang menghubungkan setiap node (satu arah “next”).

Single Linked List non


A B C D null
Circular FFF1 FFF2 FFF3
Pengertian: FFF3
Single : artinya field pointer-nya hanya satu buah saja dan satu Setiap node pada linked list mempunyai field yang berisi pointer kenode
arahserta pada akhir node, pointernya menunjuk NULL berikutnya, dan juga memiliki field yang berisi data.Node terakhir akan
Linked List : artinya node-node tersebut saling menunjuk ke NULL yang akan digunakansebagai kondisi berhenti pada
terhubung satusama lain. saat pembacaan isi linked list.

}
Single Linked List (senarai berkait
tunggal)
{ Single Linked List Circular
SLLC adalah Single Linked List yang pointer nextnya menunjuk pada dirinya sendiri. Jika Single Linked List
tersebut terdiri dari beberapa node, maka pointer next pada node terakhir akan menunjuk ke node terdepannya.
Pengertian:
Single : artinya field pointer-nya hanya satu buah saja dan satuarah.Linked List : artinya node-node tersebut
saling terhubung satusama lain.
Circular : artinya pointer next-nya akan menunjuk pada dirinyasendiri sehingga berputar

}
DATA Pointer

Menempati Alamat memori tertentu


Double Linked List (senarai berkait
ganda)
{ Double Linked List Non Circular
DLLNC adalah Double Linked List yang memiliki 2 buah pointer yaitu pointer next dan prev. Pointer next
menunjuk pada node setelahnya dan pointer prev menunjuk pada node sebelumnya.
Pengertian:
• Double : artinya field pointer-nya dua buah dan duaarah, ke node sebelum dan sesudahnya.
• Linked List : artinya node-node tersebut salingterhubung satu sama lain.
• Non Circular : artinya pointer prev dan next-nya akanmenunjuk pada NULL.

}
Pointer Pointer
Data
null Prev next null

Menempati Alamat memori tertentu


Double Linked List (senarai berkait
ganda)
{ o
Double Linked List Circular
Double Linked List Circular adalah linked list dengan menggunakanpointer, dimana setiap node memiliki 3 field, yaitu 1 field
pointeryang menunjuk pointer berikutnya (next), 1 field menunjuk pointer sebelumnya (prev), serta sebuah field yang berisi data
untuk node tersebut.
o Double Linked List Circular pointer next dan prev nya menunjuk kedirinya sendiri secara circular.
o Pengertian:
• Double: artinya field pointer-nya terdiri dari dua buah dan duaarah, yaitu prev dan next.
• Linked List: artinya node-node tersebut saling terhubung satusama lain.Circular: artinya pointer next dan prev-nya
menunjuk ke dirinyasendiri

}
Pointer Pointer
Data
Prev next

Menempati Alamat memori tertentu


01 { ..
Name of the section
< You can enter a subtitle here if you need it >

} ..
Do you need longer text?
Mercury is the closest planet to the Sun and the Mercury takes a little more than 58 days to
smallest one in the entire Solar System. This complete its rotation, so try to imagine how
planet's name has nothing to do with the liquid long days must be there! Since the
metal, since Mercury was named after the temperatures are so extreme, albeit not as
Roman messenger god. It isn’t as hot as Venus, extreme as on Venus, Mercury has been
for instance deemed to be non-habitable for humans

{ ..
The slide title goes here!

*
Do you know what helps you make your point crystal clear? Lists
like this one:

● They’re simple
● You can organize your ideas clearly
● You’ll never forget to buy milk!

And the most important thing: the audience won’t miss the point
of your presentation
You can divide the content

{ Mercury Venus
Mercury is the closest planet to the Venus has a beautiful name and is
Sun and the smallest one in the the second planet from the Sun. It’s

}
Solar System—it’s only a bit larger hot and has a poisonous atmosphere
than the Moon
Here are three ideas

Mercury
...
Mercury is the closest planet
to the Sun and the smallest of Venus
them all
Venus has a beautiful name Mars
and is the second planet from
the Sun Despite being red, Mars is
actually a cold place. It’s full
of iron oxide
Practical exercise 01
Write a Java program to print 'Hello' on screen and then print your
name on a separate line.

Expected output:
Hello
Sofia Hill
Here are four concepts
Mars Venus
Despite being red, Mars Venus has a nice name
is a cold place and a very toxic
atmosphere

Jupiter Saturn
Jupiter is the biggest Saturn is a gas giant and
planet of them all has several rings
{ .. Here are six concepts
Mars Venus Neptune
Despite being red, Mars Venus has a nice name Neptune is the farthest
is a cold place and a very toxic planet from the Sun
atmosphere

Mercury Saturn Jupiter


Mercury is the closest Saturn is a gas giant Jupiter is the biggest
planet to the Sun with several rings planet of them all

} ..
Practical exercise 02
Write a Java program to divide two numbers and print on the
screen.
Test data:
80/2
Expected output:
40

} ..
{ ..

Awesome
words
} ..
Practical exercise 03
Write a Java program that takes two numbers as input and
displays the product of two numbers.

Test data:
Input first number: 70
Input second number: 4
Expected output:
70 x 4 = 280
{ ..

“This is a quote, words full of wisdom that


someone important said and that can inspire
the reader.”

—Someone Famous
} ..
A picture is worth a thousand words
A picture
always
reinforces
the concept
Images reveal large amounts of data, so
remember: use an image instead of a
long text. Your audience will appreciate
it
Practical exercise 04
Write a Java program to print the sum (addition), multiplication,
subtraction, division and remainder of two numbers.
Test data:
Input first number: 200
Input second number: 55
Expected Output:
200 + 55 = 255
200 - 55 = 145
200 x 55 = 11000
200 / 55 = 3,63

} ..
200 mod 5 = 35
{
98,300,000
< Big numbers catch your audience’s attention >

}
9h 55m 23s
Jupiter’s rotation period

333,000
The Sun’s mass compared to Earth’s

386,000 km
Distance between Earth and the Moon
Let’s use some percentages

25% 50% 75%


*
Mercury Venus Mars
Mercury is the closest Venus has a beautiful name Despite being red, Mars is
planet to the Sun and the and is the second planet actually a cold place. It’s
smallest one from the Sun full of iron oxide
Practical exercise 05

Write a Java program to convert a binary number into a


hexadecimal number.

Input data:

Input a binary number: 10010

Expected output:

Hexadecimal value: D
{ Computer
mockup
You can replace the image on the screen
with your own work. Just right-click on it
and select “Replace image”

... }
{ Tablet mockup
You can replace the image on the screen with
your own work. Just right-click on it and select
“Replace image”

}
{
Phone mockup
You can replace the image on the screen
with your own work. Just right-click on it
and select “Replace image”

... }
{ .. This is a map
Venus
Venus is the second planet
from the Sun

Mercury
Mercury is the closest
planet to the Sun

Mars
Despite being red, Mars is

.. }
a very cold place
A timeline always works well

*
{ Venus is the second planet
from the Sun
Despite being red, Mars is
a very cold place

Mercury is the closest Jupiter is the biggest

}
planet to the Sun planet of them all
Infographics are useful

{ .. Mars Venus
Mars is a Venus is a
red planet Solar System hot planet

Mercury Jupiter
Mercury is Jupiter is a
very small gas giant

} ..
Practical exercise 06
Write a Java program to check whether Java is installed on your
computer.

Expected output:

Java Version: 1.8.0_71

Java Runtime Version: 1.8.0_71-b15

Java Home: /opt/jdk/jdk1.8.0_71/jre

Java Vendor: Oracle Corporation

Java Vendor URL: http://Java.oracle.com/


Use tables to represent data

{ Team A Team B Team C Team D

Mercury 0.06 0.53 0.38 0.38

Mars 0.11 9.4 0.53 0.78

Saturn 95.2 1.16 9.4 1.16

}
You can use this graph

Mercury
Mercury is the smallest
planet
Venus
Venus has very high
temperatures
*
Jupiter Saturn
Jupiter is the biggest Saturn is a gas giant with
planet rings

Follow the link in the graph to modify its data and then paste the new one here. For more info, click here
Practical exercise 07

Write a Java program to reverse a string.

Input data:

Input a string: My dog’s name is Ralph

Expected output:

Reverse string: hplaR si eman s‘god yM


Thanks!
< Do you have any questions? >
[email protected]
+34 654 321 432
yourwebsite.com

CREDITS: This presentation template was created by Slidesgo, and includes


icons by Flaticon, and infographics & images by Freepik

Please keep this slide for attribution


Alternative resources
Here’s an assortment of alternative resources whose style fits the one of this template:
● Programmers concept with flat design
Resources
Did you like the resources on this template? Get them for free at our other websites:

Photos
● Html and css collage concept with person I
● Html and css collage concept with person II
● Html and css collage concept with person III
● Html and css collage concept with person IV
● Medium shot smiley woman at library
● Medium shot man holding notebook
Instructions for use
If you have a free account, in order to use this template, you must credit Slidesgo by keeping the Thanks slide. Please
refer to the next slide to read the instructions for premium users.

As a Free user, you are allowed to:


● Modify this template.
● Use it for both personal and commercial projects.

You are not allowed to:


● Sublicense, sell or rent any of Slidesgo Content (or a modified version of Slidesgo Content).
● Distribute Slidesgo Content unless it has been expressly authorized by Slidesgo.
● Include Slidesgo Content in an online or offline database or file.
● Offer Slidesgo templates (or modified versions of Slidesgo templates) for download.
● Acquire the copyright of Slidesgo Content.

For more information about editing slides, please read our FAQs or visit our blog:
https://slidesgo.com/faqs and https://slidesgo.com/slidesgo-school
Instructions for use (premium users)
As a Premium user, you can use this template without attributing Slidesgo or keeping the Thanks slide.

You are allowed to:


● Modify this template.
● Use it for both personal and commercial purposes.
● Hide or delete the “Thanks” slide and the mention to Slidesgo in the credits.
● Share this template in an editable format with people who are not part of your team.

You are not allowed to:


● Sublicense, sell or rent this Slidesgo Template (or a modified version of this Slidesgo Template).
● Distribute this Slidesgo Template (or a modified version of this Slidesgo Template) or include it in a database or in
any other product or service that offers downloadable images, icons or presentations that may be subject to
distribution or resale.
● Use any of the elements that are part of this Slidesgo Template in an isolated and separated way from this
Template.
● Register any of the elements that are part of this template as a trademark or logo, or register it as a work in an
intellectual property registry or similar.

For more information about editing slides, please read our FAQs or visit our blog:
https://slidesgo.com/faqs and https://slidesgo.com/slidesgo-school
Fonts & colors used
This presentation has been made using the following fonts:

Source Code Pro


(https://fonts.google.com/specimen/Source+Code+Pro)

#e7e7e7 #10111a #fd4a4a #ec7955 #e81a81

#94ee6b #4cae97 #bd64b5 #ffff99 #2c293a


Storyset
Create your Story with our illustrated concepts. Choose the style you like the most, edit its colors, pick the background
and layers you want to show and bring them to life with the animator panel! It will boost your presentation. Check out h
ow it works.

Pana Amico Bro Rafiki Cuate


Use our editable graphic resources...
You can easily resize these resources without losing quality. To change the color, just ungroup the resource and click on
the object you want to change. Then, click on the paint bucket and select the color you want. Group the resource again
when you’re done. You can also look for more infographics on Slidesgo.
JANUARY FEBRUARY MARCH APRIL MAY JUNE

PHASE 1

Task 1

Task 2

PHASE 2

Task 1

Task 2

JANUARY FEBRUARY MARCH APRIL

PHASE 1

Task 1

Task 2
...and our sets of editable icons
You can resize these icons without losing quality.
You can change the stroke and fill color; just select the icon and click on the paint bucket/pen.
In Google Slides, you can also use Flaticon’s extension, allowing you to customize and add even more icons.
Educational Icons Medical Icons
Business Icons Teamwork Icons
Help & Support Icons Avatar Icons
Creative Process Icons Performing Arts Icons
Nature Icons
SEO & Marketing Icons

Anda mungkin juga menyukai