Computational Thinking: Slide-2

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

Session 2

Computational
Concept
Objectives
- Explain how to apply a systematic
approach to problem-solving.
- Discuss how to create a problem
definition.
- Introduce strategies and considerations
for the devising of solutions.
- Explain decomposition as a problem-
solving strategy.
- Show the benefits of generalising from
patterns in problems as well as techniques
for creating them.
CT Approach

Abstraction -Pulling out specific differences to Algorithm - A list of steps that you can
make one solution work for multiple problems follow to finish a task

Decompose - Break a problem down into Pattern Matching - Finding similarities between
smaller pieces things
Compute 1 + 2 + 3 + ... + 198 + 199 + 200 ?
• See a pattern? (pattern matching)
How many of these pairs will we have? What is the
Answer: last pair we will find? 100 + 101
- Decompose That means that we have 100 total pairs.
Let's start at the two ends. If we have 100 total pairs of sums of 201, how do
What is 200 + 1? we find the final total?
What is 100 * 201?
What is 199 + 2? Now, what if we wanted to find the trick to do this
What is 198 + 3? with other numbers?
• Abstraction
• Can we do it easily with 2,000? • If we use abstractions to make our end
• How about 20,000? goal something that can change (say we
name it "blank") then we can make an
• What stays the same? What is different?
Algorithm that will work for any number
Komputasi dan Kalkulasi
- To Compute, to Calculate
- Calculation melibatkan
perhitungan angka
- Computation lebih luas dari
Calculation
- Kalkulasi dapat dibuat
komputasinya
- Greatest Common Divisor (GCD);
Mencari akar-akar persamaan
kuadrat; Mengkonversi suhu dari
skala Celsius ke Fahrenheit; dsb
- Hal yang dapat dikomputasikan
belum tentu melibatkan aktifitas
perhitungan angka
Computing Machine
- Secara definisi matematis, sebuah
Mesin Komputasi terdiri atas:
- Himpunan Simbol
- Pita
- Pengendali (Controller / Automata)
- Simbol ditulis dalam Pita
- Panjang Pita diasumsikan tak berhingga
- Pengendali melakukan rangkaian aksi
berdasarkan simbol-simbol yang dibaca dari
Pita
- https://www.youtube.com/watch?
v=84pbZSt_a9k
Komputasi
- Mesin Komputasi diwujudkan dalam
komponen-komponen CPU, RAM, dan
perangkat Luaran/Masukan (I/O device)
dalam sebuah arsitektur von Neumann

- Siklus Fetch-Decode-Execute
- Semua tahapan dalam Mesin Komputasi
dilaksanakan secara berurut (Sequential)
Problem Solving
Pólya, “How to Solve It”
(1973) advocates:

- understand the problem;


- devise a plan;
- execute the plan;
- review and extend.
Problem Solving
First, don’t be put off by
perceived size and
complexity.

Second, resist the urge to


jump straight into writing a
solution.
Decomposition

- Membagi masalah awal ke


dalam sub-problems yang
lebih mudah untuk
dipecahkan
- Sub-masalah dapat dipecah
ke dalam sub-sub-problems
jika diperlukan
- Struktur Pohon (Tree)
 Dekomposisi ialah proses pemecahan suatu masalah kompleks
menjadi masalah yang kecil kecil agar masalah tersebut mudah
dipahami, diteliti dan diselesaikan secara terpisah.
 Tujuannya membantu pemecahan masalah yang tergolong rumit
dan merancang penyelesaiannya.
 Ini penting karena jika masalah tidak didekomposisi maka akan
lebih sulit untuk dipecahkan.
 Menyelesaikan masalah sederhana dan satu persatu lebih mudah
daripada menyelesaikan masalah sekaligus.
 Menyelesaikan masalah secara dekomposisi juga berarti
menyelesaikan masalah secara detail.
Patterns and Generalization
Compute 1 + 2 + 3 + ... + 198 + 199 + 200 ?

Compute 1 + 2 + 3 + ... + 1998 + 1999 + 2000?

Compute 101 +102 + ... + 19999 + 20000?

Compute a + (a+2) + (a+4) + ... + (a+2n)?


Algorithm
- Before there were computers, there were algorithms. But now
that there are computers, there are even more algorithms, and
algorithms lie at the heart of computing.

- a sequence of clearly defined steps that describe a process to


follow a finite set of unambiguous instructions with clear start
and end points.
- Step-by-step
- Correct
- Finite
Mengurutkan Data
- Salah satu hal yang paling sering ditemukan dalam dunia Ilmu
Komputer.
- Diberikan sekumpulan data dalam keadaan tidak terurut, lakukan
langkah-langkah yang diperlukan sehingga data tersebut menjadi
terurut
- 1, 2, 3, -1, 5, 7, 6, 8, 9, 0, 4, -2, -3
Latihan / Diskusi
Seorang Petani (P) membawa seekor Kambing (K), seekor Serigala (S), dan satu
bakul saYuran (Y) dari tempat tinggalnya di desa menuju kota. Dalam perjalanan,
P bertemu dengan sebuah sungai yang harus diseberangi. Di tepian sungai
terdapat satu perahu kecil yang hanya dapat digunakan oleh P dan salah satu dari
barang bawaannya (K, S, atau Y).

Sebagai seorang calon insinyur FTI, anda diminta untuk membantu P


menyeberangi sungai dengan membawa semua barang bawaannya.
References
● https://code.org/curriculum/course3/1/Teacher

You might also like