Pemrograman Dinamis - Berpikir Komputasional | Informatika XI

Sinau Maning
15 Aug 202322:02

Summary

TLDRThis video script delves into the concept of dynamic programming (DP), a computational technique used to solve optimization problems by breaking them into subproblems and storing the results to avoid redundant calculations. The script uses the example of harvesting chili peppers in a grid to illustrate how DP can efficiently find the maximum number of peppers collected, contrasting it with the 3D technique which might not yield the optimal solution. It also touches on the application of DP in everyday life, such as currency exchange, and ends with a reflection on the differences between 3D algorithms and dynamic programming, highlighting their strengths and weaknesses.

Takeaways

  • 📚 Dynamic programming (DP) is a method used to solve optimization problems by breaking them down into simpler subproblems.
  • 🔍 DP is particularly useful for problems where decisions have consequences on future steps, making traditional techniques like the 3D technique suboptimal.
  • 🔑 The two main components of DP are optimization (finding the maximum or minimum value) and the recursive formulation of the problem, where the solution to a larger problem depends on solutions to smaller subproblems.
  • 🔄 One of the key challenges in DP is dealing with overlapping subproblems, which can lead to inefficiencies if not handled properly.
  • 💡 The technique of memoization is used in DP to store the results of subproblems, preventing the need to recalculate solutions and thus improving efficiency.
  • 🌰 The script provides an example of a problem involving harvesting chili peppers arranged in a grid, illustrating how DP can be applied to find the maximum number of peppers that can be collected.
  • 🚫 The 3D technique is not suitable for the chili harvesting problem because it does not consider the consequences of choosing one path over another, potentially leading to a non-optimal solution.
  • 🔢 The script discusses a numerical example where different paths can lead to different totals of collected peppers, emphasizing the need for a method like DP to find the optimal path.
  • 🔄 The process of DP involves filling out a memoization table, starting with the initial conditions and building up to the solution for the entire problem.
  • 🎯 The final result of the DP process is the maximum or optimal value for the problem, which, in the case of the chili harvesting example, is the maximum number of peppers that can be collected.
  • 🤔 The script concludes with a reflection on the application of DP to real-life problems and a discussion on the differences between the 3D technique and dynamic programming, inviting the audience to consider the strengths and weaknesses of each.

Q & A

  • What is the main topic discussed in the video script?

    -The main topic discussed in the video script is Dynamic Programming (DP), a strategy in algorithmic problem-solving, particularly for optimization problems.

  • What is the difference between Dynamic Programming and the 3D technique mentioned in the script?

    -Dynamic Programming is a method that solves complex problems by breaking them down into simpler subproblems and storing the results of these subproblems to avoid redundant calculations. The 3D technique, which is not fully explained in the script, seems to be an approach that might not always yield optimal solutions, especially when there are overlapping subproblems.

  • What is the concept of 'memoization' in the context of Dynamic Programming?

    -Memoization in the context of Dynamic Programming refers to the process of storing the results of expensive function calls and reusing them when the same inputs occur again, thus reducing the computation time by avoiding the need to recompute the same results.

  • Can you provide an example of a problem solved in the script using Dynamic Programming?

    -An example provided in the script is about Adria who wants to harvest the maximum number of chili peppers from a grid of plants. The problem is solved using Dynamic Programming by considering the maximum value obtainable from the current box and the optimal values from the boxes above or to the left.

  • What is the significance of 'subproblems' in Dynamic Programming?

    -In Dynamic Programming, the significance of subproblems is that they represent smaller, more manageable parts of the main problem. Solving these subproblems and storing their solutions allows for the construction of the solution to the larger problem without redundant calculations.

  • How does the script illustrate the inefficiency of the 3D technique for the chili harvesting problem?

    -The script illustrates the inefficiency of the 3D technique by showing that if one starts with the highest value at the bottom-right corner and moves right, there are no other choices for subsequent steps, leading to a suboptimal solution.

  • What is the role of 'optimization' in the context of the problems discussed in the script?

    -In the context of the problems discussed, optimization refers to the process of finding the maximum or minimum value, such as the maximum number of chili peppers that can be harvested or the minimum number of steps required to solve a problem.

  • What is the game described in the script involving Ani and Budi?

    -The game involves Ani choosing a positive integer 'n', and Budi repeatedly changing 'n' to 1 by applying a series of steps. Budi can replace 'n' with 'n - 1' if 'n' is even, or with 'n / 2' or 'n / 3' if 'n' is divisible by 2 or 3, respectively.

  • How does the script relate Dynamic Programming to everyday life problems?

    -The script suggests that Dynamic Programming can be applied to everyday life problems that involve making a series of choices to optimize an outcome, such as the currency exchange problem where one needs to make the best possible change given a limited set of denominations.

  • What is the final question posed by the script regarding the difference between 3D algorithms and Dynamic Programming?

    -The script asks for the important differences between 3D algorithms and Dynamic Programming, including their advantages and disadvantages, and which lesson from the topic was the most effective.

Outlines

00:00

🧠 Introduction to Dynamic Programming

This paragraph introduces the concept of dynamic programming (DP) as a strategy for solving computational problems involving optimization. It contrasts DP with the 3D technique, highlighting that DP is more suitable for problems where multiple steps have consequences on subsequent steps. The explanation includes the two main elements of DP: optimization through a series of similar choices, and the recursive formulation of the desired optimal value as a combination of optimal sub-problems. It also touches on the efficiency of DP through memoization, which avoids recalculating solutions for overlapping sub-problems by storing them in a table.

05:03

🌱 Dynamic Programming Example: Adria's Chili Harvest

The second paragraph presents a practical example of applying dynamic programming to optimize the collection of chili peppers in a grid-like arrangement. It explains that using the 3D technique would not yield the optimal solution, as it would lead to suboptimal choices due to the nature of the problem. The paragraph illustrates how to approach the problem using DP, by considering the maximum value that can be obtained from the previous box either above or to the left, and adding the current box's value to find the optimal path for harvesting the maximum number of chili peppers.

10:04

📊 Memoization Table Construction in DP

This paragraph delves deeper into the process of constructing a memoization table for dynamic programming, which is essential for storing the results of sub-problems to prevent redundant calculations. It clarifies the difference between memoization and memorization, emphasizing that memoization specifically refers to saving past computation results in computing. The paragraph provides a step-by-step guide on how to fill out the memoization table, starting with the top-left box and moving right and down, using the values from the辣椒 boxes and the previously calculated values in the table to find the maximum collection of chili peppers.

15:06

🔢 The Number Game: Minimizing Steps to Reach One

The fourth paragraph introduces a number game between Ani and Budi, where the objective is to transform a given positive integer 'n' to the number one through a series of steps. The rules allow Budi to either decrement 'n' by one if it's even or divide it by two, and to divide 'n' by three if it's divisible by three. The paragraph poses a question about determining the minimum number of steps required to reach one, using 25 as an example, and asks for the reflection on the problem-solving process.

20:07

🤔 Reflections on Dynamic Programming and Its Applications

The final paragraph invites reflection on the application of dynamic programming to solve the problem of currency exchange, specifically how to change 15,000 units of currency when only 1,000, 2,000, and 10,000 denominations are available. It questions whether dynamic programming can be applied to this scenario and seeks examples of other everyday problems that can be solved using DP. The paragraph also asks for opinions on the significant differences between the 3D technique and dynamic programming, their advantages and disadvantages, and which lesson from the topic was the most effective. It concludes with a thank you note and encouragement for continued learning.

Mindmap

Keywords

💡Dynamic Programming (DP)

Dynamic Programming is an algorithmic technique used to solve complex problems by breaking them down into simpler subproblems. It is central to the video's theme, which discusses solving optimization problems efficiently. In the script, DP is used to illustrate how to maximize the number of chili peppers harvested by considering overlapping subproblems and avoiding redundant calculations, as seen in the example of Adria picking chili peppers in a grid.

💡Memoization

Memoization is a specific case of caching where the result of expensive function calls are stored to avoid re-calculating them when the same inputs occur again. It is a key concept in the script, used to explain how to efficiently implement dynamic programming by storing the solutions of subproblems to prevent redundant calculations, as mentioned in the context of filling the memoization table to solve the chili picking problem.

💡Optimization

Optimization refers to the process of finding the best solution from a set of available choices. It is a fundamental concept in the video, where the goal is to maximize or minimize a certain value, such as the number of chili peppers collected. The script uses optimization to discuss the problem-solving approach of choosing the best path to collect the maximum number of peppers.

💡Subproblem

A subproblem is a smaller instance of the original problem that needs to be solved as part of the dynamic programming approach. The script explains that the main problem is broken down into subproblems which are solved individually, with their solutions combined to solve the larger problem, as in the case of calculating the maximum number of chili peppers that can be collected from a grid.

💡Recursive

Recursive refers to a process that defines a problem in terms of smaller instances of the same problem. In the video, the concept of recursion is used to explain how the solution to the main problem can be expressed as a combination of optimal solutions to the same subproblem but with smaller sizes, as demonstrated in the dynamic programming approach to the chili picking problem.

💡3D Technique

The 3D Technique mentioned in the script is a problem-solving approach that may not yield the optimal solution for certain types of problems. It is contrasted with dynamic programming to illustrate the limitations of the 3D Technique, such as when it cannot consider all possible combinations of steps to solve the chili picking problem optimally.

💡Overlapping Subproblems

Overlapping subproblems occur when multiple subproblems share the same sub-structure and thus can reuse the solutions of smaller instances. The script discusses the importance of overlapping subproblems in dynamic programming, where the memoization technique is used to store and reuse solutions to avoid redundant calculations, as seen in the example of calculating the maximum number of chili peppers.

💡Memoization Table

A memoization table is a data structure used to store the results of expensive function calls and return the cached result when the same inputs occur again. In the script, the memoization table is used to implement the dynamic programming solution for the chili picking problem, where it stores the maximum number of peppers that can be collected up to each cell in the grid.

💡Computational Efficiency

Computational efficiency refers to the effectiveness of an algorithm in terms of the resources it uses, particularly time and space. The script emphasizes the importance of computational efficiency in dynamic programming by using memoization to avoid redundant calculations and thus improve the efficiency of solving the chili picking problem.

💡Bounded Rationality

Although not explicitly mentioned in the script, the concept of bounded rationality is implied when discussing the limitations of the 3D Technique. Bounded rationality refers to the idea that in decision-making, the rationality of individuals is limited by the information they have, the cognitive limitations of their minds, and the finite amount of time they have to make decisions. The script suggests that dynamic programming, with its systematic approach, can overcome some of these limitations by considering all possible combinations of steps.

💡Algorithmic Strategy

An algorithmic strategy refers to a systematic approach to solving a problem using algorithms. The script discusses dynamic programming as an algorithmic strategy that involves breaking down a problem into subproblems, solving each subproblem just once, and storing their solutions - a strategy that is particularly effective for optimization problems with overlapping subproblems and optimal substructure.

Highlights

Introduction to dynamic programming as a computational strategy in informatics for solving optimization problems.

Explanation of dynamic programming's two main elements: optimization through a series of similar choices and the recursive expression of the desired optimal value.

Discussion on the inefficiency of the 3D technique for certain problems and the suitability of dynamic programming in such cases.

The concept of overlapping subproblems in dynamic programming and the need for an efficient calculation method to avoid redundant computations.

Introduction to memoization as a technique to store solutions of subproblems to improve computational efficiency.

Illustration of a problem involving harvesting chili peppers in a grid, demonstrating the application of dynamic programming.

The process of calculating the maximum number of chili peppers Adria can collect using dynamic programming.

Comparison between the 3D technique and dynamic programming, highlighting the limitations and advantages of each.

The importance of memoization in avoiding unnecessary recalculations and its role in computational efficiency.

A detailed example of filling out a memoization table to solve the chili harvesting problem optimally.

The final result of the memoization table, showing the maximum total number of chili peppers that can be collected.

Introduction to a numerical game between Ani and Budi, involving dynamic programming to determine the minimum number of steps to reduce a number to one.

The rules of the game, where Budi can change the number based on whether it is even or divisible by three.

A practical example of the game, starting with the number 5, and the steps Budi takes to reduce it to one.

A challenge posed to the audience to determine the minimum number of steps required if Ani chooses n = 25.

Reflection on the application of dynamic programming in currency exchange problems, specifically with limited available denominations.

Discussion on the potential of dynamic programming to solve everyday life problems and the concept of memoization in various contexts.

A question posed to the audience about the significant differences between the 3D technique and dynamic programming, including their advantages and disadvantages.

A conclusion summarizing the importance of dynamic programming in computational thinking and its applications in algorithmic strategies.

Transcripts

play00:00

[Musik]

play00:08

Assalamualaikum warahmatullahi

play00:10

wabarakatuh kembali lagi di pelajaran

play00:13

Informatika kelas 11 masih di materi

play00:17

strategi algoritmik dan pemrograman

play00:20

berpikir komputasional pada subbab

play00:24

pemrograman dinamis

play00:30

saat menyelesaikan sebuah permasalahan

play00:32

optimasi yaitu mencari nilai terbesar

play00:35

atau terkecil Terkadang kita harus

play00:38

memperhitungkan beberapa kemungkinan

play00:40

pengambilan langkah untuk menyelesaikan

play00:43

permasalahan tersebut

play00:46

kemungkinan-kemungkinan tersebut mungkin

play00:48

memiliki akibat atau konsekuensi

play00:51

terhadap langkah-langkah selanjutnya

play00:54

sehingga pendekatan seperti Teknik 3D

play00:58

mungkin tidak akan menghasilkan jawaban

play01:01

yang optimal dalam hal ini teknik

play01:04

pemrograman dinamis atau Dynamic

play01:07

programming atau DP mungkin akan lebih

play01:10

sesuai diterapkan teknik DP mengandung

play01:13

dua unsur utama yaitu yang pertama

play01:17

optimasi atau mencari nilai terkecil

play01:20

atau terbesar melalui serangkaian

play01:24

pilihan

play01:26

serupa dengan Teknik 3D kita harus

play01:29

menentukan rangkaian Langkah apa yang

play01:32

akan menghasilkan nilai optimal di akhir

play01:34

namun beberapa dengan permasalahan yang

play01:38

dapat diselesaikan dengan Teknik 3D

play01:41

permasalahan yang sesuai untuk teknik GP

play01:44

memiliki struktur sedemikian rupa

play01:46

sehingga pilihan langkah terbaik saat

play01:49

ini belum tentu merupakan pilihan

play01:52

terbaik secara keseluruhan

play01:55

sehingga prinsip Bride belum tentu dapat

play01:58

diterapkan dan semua kemungkinan

play02:01

kombinasi pilihan langkah harus

play02:03

diperhitungkan

play02:06

yang kedua nilai optimal yang diinginkan

play02:10

untuk permasalahan tersebut biasanya

play02:12

dapat dinyatakan sebagai kombinasi

play02:15

optimal dari sub permasalahan yang sama

play02:19

tetapi dengan ukuran yang lebih kecil

play02:22

atau dengan kata lain dapat dinyatakan

play02:25

secara rekursif

play02:27

namun sub permasalahan yang harus

play02:30

dipertimbangkan biasanya memiliki

play02:33

overlap atau persinggungan Sehingga

play02:36

dalam proses perhitungannya diperlukan

play02:39

cara yang efisien untuk menghitung

play02:42

solusi untuk sub permasalahan yang

play02:45

diperlukan agar tidak terjadi perulangan

play02:49

atau duplikasi dalam proses perhitungan

play02:54

cara yang umum digunakan adalah dengan

play02:56

menyimpan semua solusi dari sub problem

play03:00

yang sudah diketahui dalam sebuah tempat

play03:02

penyimpanan atau tabel Teknik ini biasa

play03:07

disebut dengan teknik memorisasi

play03:09

[Musik]

play03:12

contoh

play03:13

agria ingin memanen tanaman cabai di

play03:17

halaman rumahnya

play03:18

tanaman tersebut ditata dalam bentuk

play03:21

kotak-kotak persegi seperti ilustrasi

play03:24

pada gambar

play03:26

angka pada setiap kotak memiliki jumlah

play03:29

cabai yang ada di masing-masing tanaman

play03:34

berikut tabelnya

play03:36

kotak-kotaknya yang sebelah kiri 0

play03:39

berarti

play03:40

tidak ada cabainya kemudian sebelah

play03:44

kanannya ada satu dua tiga itu

play03:47

melambangkan

play03:48

cabai yang ada pada tanaman di kotak

play03:52

tersebut

play03:53

kemudian di bawahnya ada 10 2 10 5

play04:01

agria tidak punya banyak waktu karena ia

play04:04

harus segera pergi ke kampus Oleh karena

play04:07

itu ia tidak bisa memetik seluruh cabai

play04:10

tersebut Ia hanya bisa mulai dari kotak

play04:13

manapun di kolom paling kiri dan

play04:16

berhenti di kotak manapun di kolom

play04:19

paling kanan

play04:21

agria hanya bisa bergerak ke kotak tepat

play04:25

setelah kanannya atau bawahnya berikut

play04:29

adalah salah satu dari sekian banyak

play04:32

kemungkinan jalur yang dapat dilalui

play04:34

oleh agria untuk memetik cabai pada

play04:39

gambar agria mulai dari

play04:43

baris yang ketiga di situ yang berwarna

play04:46

kuning kemudian bergerak ke kanan

play04:50

tiga kotak kemudian lanjut ke bawah

play04:54

Terus lanjut ke kanan dan selesai

play05:02

pertanyaannya adalah Berapakah jumlah

play05:06

cabai terbanyak yang bisa dikumpulkan

play05:08

oleh Adria

play05:10

berikut jawabannya pertama perlu

play05:14

dipahami bahwa penggunaan Teknik 3D pada

play05:17

permasalahan ini tidak akan menghasilkan

play05:19

jawaban yang benar atau optimal

play05:23

dapat dilihat bahwa jika kita

play05:26

menggunakan prinsip 3D maka kita akan

play05:29

memilih untuk memulai dari kolom pertama

play05:32

baris terakhir dengan nilai jumlah cabe

play05:36

terbesar yaitu 20 namun jika kita

play05:41

memulai dari sini maka tidak ada pilihan

play05:44

lain untuk langkah-langkah selanjutnya

play05:47

selain bergerak terus ke kanan maka

play05:50

nilai total cabe yang akan didapatkan

play05:53

adalah 20 ditambah 5 ditambah 1 + 0 + 0

play06:00

sehingga menghasilkan

play06:02

26 cabai

play06:06

jelas bahwa ada pilihan-pilihan jalur

play06:09

lain yang akan menghasilkan total nilai

play06:11

cabe lebih dari 26

play06:15

misalnya langkah sebagai berikut akan

play06:18

menghasilkan jumlah total cabe nol

play06:22

ditambah 10 tambah 2 tambah 10 tambah 10

play06:26

tambah 5 sehingga menghasilkan

play06:30

37 cabai

play06:34

metode berikutnya yang bisa kita

play06:36

pikirkan solusinya adalah mencoba semua

play06:39

kemungkinan jalur lalu menghitung Berapa

play06:43

nilai total cabai yang bisa didapatkan

play06:45

dan terakhir mencari nilai terbesarnya

play06:49

namun dengan metode ini kita menemukan

play06:52

kendala lainnya yaitu akan ada terlalu

play06:56

banyak kemungkinan yang harus kita

play06:59

perhitungkan

play07:01

satu hal yang dapat kita segera pahami

play07:04

adalah bahwa ada banyak sekali

play07:07

persinggungan antara jalur-jalur yang

play07:09

berbeda sedemikian rupa sehingga akan

play07:13

ada banyak sekali perulangan yang tidak

play07:16

perlu ketika kita menghitung nilai total

play07:19

cabai dari semua kemungkinan jalur yang

play07:22

ada sebagai contoh kedua jalur di bawah

play07:26

ini yaitu jalur merah dan jalur biru

play07:30

akan melalui 4 kotak yang sama dan

play07:34

menghitung penjumlahan dari nilai di

play07:37

keempat kotak yang sama tersebut yaitu

play07:40

pada kotak yang berwarna kuning

play07:44

misalkan pada jalur biru yaitu dari

play07:48

kotak pojok kiri atas ke bawah

play07:52

kemudian ke kanan

play07:55

empat kali dan

play07:58

jalur yang berwarna merah dari pojok

play08:01

kiri atas ke kanan kemudian ke bawah dan

play08:06

selanjutnya ke kanan tiga kali tentunya

play08:10

pada jalur merah dan jalur biru

play08:13

sama-sama melalui jalur yang berwarna

play08:17

kuning

play08:19

dengan menggunakan prinsip Dynamic

play08:22

programming atau DP yang perlu kita

play08:25

lakukan adalah

play08:26

pertama-tama menyatakan solusi atau

play08:29

penyelesaian dari permasalahan awal

play08:32

sebagai kombinasi dari sub permasalahan

play08:35

yang lebih kecil

play08:37

dalam hal ini kita dapat membuat

play08:40

argumentasi bahwa nilai jumlah cabe

play08:43

terbanyak yang bisa kita kumpulkan

play08:45

sampai dengan suatu kotak tertentu

play08:48

dimanapun kolomnya tergantung dari nilai

play08:52

terbaik jumlah cabai sampai dengan Kotak

play08:55

di atasnya atau Kotak di sebelah kirinya

play08:59

jika ada dan tinggal kita jumlahkan saja

play09:04

dengan nilai banyaknya cabai di kotak

play09:07

akhir tersebut

play09:08

hal ini Tentunya karena kita hanya bisa

play09:13

bergerak ke kanan atau ke bawah saja

play09:19

Jika nilai terbaik yang bisa kita

play09:21

dapatkan akan berakhir pada kotak warna

play09:24

hitam seperti pada gambar dapat dihitung

play09:27

dengan cara menghitung nilai terbaik

play09:29

yang didapatkan sampai dengan Kotak

play09:32

Merah misalkan nilainya adalah A dan

play09:36

sampai dengan kotak berwarna biru

play09:39

misalkan nilainya adalah b maka untuk

play09:43

mendapatkan nilai terbaik sampai dengan

play09:45

kotak warna hitam kita hanya mencari

play09:49

manakah jumlah yang tertinggi antara

play09:51

nilai a dan b kemudian nilai tersebut

play09:56

dijumlahkan dengan nilai

play10:01

C proses di atas mengubah permasalahan

play10:04

ini menjadi lebih rekursif Dimana kita

play10:07

bisa menggunakan hasil perhitungan pada

play10:09

kotak-kotak sebelumnya untuk menghitung

play10:12

nilai terbaik pada kotak-kotak

play10:15

selanjutnya yang berada di posisi lebih

play10:18

ke kanan atau lebih ke bawah

play10:22

sehingga dengan cara ini kita bisa

play10:25

menghindari perulangan atau duplikasi

play10:27

proses perhitungan

play10:30

proses ini biasanya menggunakan sebuah

play10:33

tabel perhitungan yang biasa disebut

play10:35

dengan tabel memoilisasi atau tabel DP

play10:42

istilah memonilisasi berasal dari bahasa

play10:44

latin yaitu memorandum yang berarti

play10:48

mengingat yang kemudian bisa disingkat

play10:51

sebagai memo dalam bahasa Inggris

play10:56

mohon dibedakan istilah memoilisasi ini

play10:59

dengan memorilisasi atau memori season

play11:02

yang juga memiliki arti yang serupa

play11:05

yaitu proses pengingat namun memoilisasi

play11:09

memiliki arti yang khusus dalam dunia

play11:12

komputasi yaitu menyimpan atau mengingat

play11:16

hasil perhitungan yang telah dilakukan

play11:18

sebelumnya sehingga kita perlu mengulang

play11:22

perhitungan yang sama dua kali

play11:25

[Musik]

play11:27

untuk soal ini kita buat tabel

play11:29

memoilisasi tersebut sebagai berikut

play11:32

yang pertama kotak paling kiri atas kita

play11:35

berikan nilai sama dengan nilai kotak

play11:38

tersebut yaitu nol

play11:41

Kemudian untuk setiap kotak lainnya

play11:43

misalkan a adalah nilai yang sudah

play11:47

dihitung pada tabel memoilisasi untuk

play11:50

kotak yang ada di atasnya atau 0 Jika

play11:54

Kotak saat ini ada di baris teratas dan

play11:58

b adalah nilai yang sudah dihitung pada

play12:02

tabel memoilisasi untuk kotak yang ada

play12:04

di sebelah kirinya atau nol jika Kotak

play12:09

saat ini ada di kolom paling kiri serta

play12:12

misalkan c adalah nilai cabe yang ada

play12:16

pada Kotak saat ini maka kita isi Kotak

play12:20

saat ini pada tabel memoilisasi dengan

play12:23

nilai maksimal dari a atau b Kemudian

play12:27

ditambahkan C

play12:30

langkah berikutnya kita lakukan proses

play12:32

di atas sampai tabel memoilisasi terisi

play12:35

penuh sesuai ukuran tabel nilai cabe di

play12:40

awal nilai paling besar pada tabel

play12:42

memodifikasi menunjukkan nilai total

play12:45

jumlah cabai terbesar yang bisa

play12:47

dikumpulkan

play12:50

hasil tabel memoilisasi yang sudah

play12:52

terisi penuh untuk soal di atas adalah

play12:55

sebagai berikut

play13:01

tabel di atas adalah kotak tanaman cabai

play13:04

kemudian tabel di bawah adalah tabel

play13:06

hasil memoilisasi

play13:10

pada kotak paling kiri atas yaitu 0

play13:15

tidak ada cabainya kemudian bergerak

play13:19

satu kolom ke kanan

play13:22

menghasilkan satu

play13:24

kemudian

play13:26

[Musik]

play13:27

bergerak satu kolom ke kanan yang ada

play13:31

isi cabenya yaitu 2

play13:34

sehingga pada

play13:36

tabel hasil memoilisasi menghasilkan 3

play13:41

kemudian

play13:43

jika ke kanan yang berisi 3 maka di situ

play13:47

tabel minoisasinya adalah 6 dan jika ke

play13:51

kanan lagi yang ada cabenya yang berisi

play13:55

10 maka

play13:58

tabel memoilisasi menghasilkan 16

play14:03

kembali ke sebelah kiri lagi pada baris

play14:06

kedua

play14:07

di situ ada

play14:10

cabai yang berisi 10

play14:13

maka tabel imunisasinya adalah 10 karena

play14:18

di atasnya adalah nol

play14:21

kemudian di sebelah kanannya

play14:25

Masih pada baris kedua

play14:29

di situ ada

play14:32

kotak tanaman cabenya adalah

play14:34

2 HP sehingga pada tabel hasil

play14:38

memoilisasi adalah 12 kemudian di

play14:43

sebelah kanannya

play14:45

otaknya yaitu

play14:48

ada 10 sehingga pada tabel memoilisasi

play14:52

adalah 22

play14:55

kemudian di sebelah kanannya lagi adalah

play14:59

302 karena 22 ditambah 10 kemudian di

play15:06

sebelah kanannya adalah hasil tabel

play15:08

memoilisasinya adalah 37 nah 32 ditambah

play15:16

332 + 5 = 37

play15:21

pada baris yang ketiga yaitu

play15:25

tabel memoilisasi menghasilkan 15

play15:29

itu dari 10 ya tasnya ditambahkan isi

play15:34

dari kotak tanaman cabe yaitu 5

play15:37

kemudian di sebelah kanannya adalah 18

play15:40

berasal dari 15 ditambah 3 hasilkan 18

play15:48

kemudian di sebelah kanannya

play15:52

kotak tanaman cabenya berisi 6 yang kita

play15:56

tambahkan adalah yang paling banyak

play15:59

yaitu

play16:01

22 ditambah 6 sehingga menghasilkan

play16:05

28 kemudian di sebelah kanannya adalah 5

play16:12

sehingga menghasilkan tabel momen isasi

play16:15

adalah 37 karena 32 ditambah 5

play16:21

kemudian di sebelah kanannya lagi tetap

play16:24

37 karena kotak tanaman cabenya adalah 0

play16:30

pada baris yang keempat di situ kotak

play16:33

tanaman cabenya adalah 0 maka tabel

play16:36

memorinya adalah 15 kemudian di sebelah

play16:41

kanannya

play16:42

dari 15 dan 18 kita pilih 18 yang paling

play16:47

banyak ditambah 4 sehingga menghasilkan

play16:51

22 kemudian sebelah kanannya tentunya

play16:56

kita pilih yang 28 karena lebih banyak

play16:59

dari 22 sehingga tabel memonya adalah

play17:04

28 kemudian di sebelah kanannya lagi

play17:07

menghasilkan

play17:09

39 yaitu 37 + 2 kemudian di sebelah

play17:15

kanannya lagi dari 39 dan 37 kita pilih

play17:21

39 sehingga tabel memorinya adalah 39 +

play17:26

3 menghasilkan 42

play17:30

pada baris yang terakhir

play17:34

di sini hasil tabel memorinya adalah 35

play17:38

didapat dari 15 + 20 kemudian

play17:45

di sebelah kanannya

play17:48

tabel kotak tanamannya adalah 5 kita

play17:52

pilih

play17:53

dari 35 dan 22 kita pilih 35 + 5 = 40

play17:59

kemudian sebelah kanannya adalah 41

play18:03

yaitu 40 + 1 kemudian sebelah kanannya

play18:07

lagi yaitu

play18:09

41 masih tetap kemudian

play18:14

kotak yang terakhir menghasilkan 42

play18:18

didapat dari hasil pilihan antara 42 dan

play18:23

41 kita pilih 42 sehingga tabel

play18:26

memorinya pada kotak terakhir adalah 402

play18:31

Ayo berlatih aktivitas bermain angka

play18:35

selanjutnya deskripsi tugasnya yaitu Ani

play18:39

dan Budi sedang bermain sebuah permainan

play18:43

angka pertama Ani akan memilih sebuah

play18:47

angka bilangan bulat positif n

play18:49

selanjutnya Budi harus mengubah bilangan

play18:52

n ini menjadi angka 1 dengan menerapkan

play18:56

serangkaian langkah sebagai berikut

play18:59

Budi boleh mengganti bilangan n dengan N

play19:03

- 1 jika bilangan saat ini adalah genap

play19:06

atau habis dibagi dua maka Budi boleh

play19:11

menggantinya dengan n dibagi dua

play19:15

jika bilangan saat ini habis dibagi 3

play19:17

maka Budi boleh menggantinya dengan n

play19:20

dibagi

play19:22

3

play19:23

proses ini harus dilakukan oleh Budi

play19:26

secara terus-menerus sampai bilangan

play19:29

yang dimilikinya menjadi satu misalnya

play19:32

Ani Memilih n adalah 5 maka Budi dapat

play19:37

melakukan Proses mengubah 5 menjadi satu

play19:40

sebagai berikut dari 5 menjadi 4 menjadi

play19:44

2 dan menjadi satu di sini kita lihat

play19:48

ada tiga langkah

play19:51

pertanyaannya adalah Tentukan Berapa

play19:54

jumlah langkah minimum yang diperlukan

play19:58

jika Ani Memilih n = 25

play20:05

setelah selesai melakukan aktivitas

play20:07

tersebut jawablah pertanyaan berikut ini

play20:09

dalam buku refleksi Menurut kalian

play20:13

apakah permasalahan penukaran uang pada

play20:15

aktivitas sebelumnya

play20:18

yaitu menukarkan uang untuk topik

play20:20

algoritma 3D sebelumnya yaitu pecahan

play20:23

yang tersedia hanya 1000 2000 dan 10.000

play20:27

dan kita ingin menukarkan nilai 15.000

play20:32

Dapatkah diselesaikan dengan teknik

play20:34

pemrograman dinamis

play20:37

dan bagaimana caranya

play20:40

kemudian Apakah ada contoh permasalahan

play20:43

yang lain dalam kehidupan sehari-hari

play20:45

yang dapat diselesaikan dengan teknik

play20:48

pemrograman dinamis atau Setidaknya di

play20:52

mana teknik memoilisasi dapat diterapkan

play20:55

[Musik]

play20:57

kemudian Menurut anda apakah yang

play21:00

menjadi perbedaan penting antara

play21:02

algoritma 3 dan pemrograman dinamis

play21:06

Adakah kekurangan dan kelebihannya

play21:08

masing-masing

play21:10

selanjutnya manakah pelajaran yang

play21:13

paling berkesan dari topik ini

play21:16

demikian tadi materi pemrograman dinamis

play21:19

pada bagian berpikir komputersional pada

play21:24

bab strategi algoritmik dan pemrograman

play21:27

Terima kasih semoga bermanfaat Selamat

play21:31

belajar dan tetap semangat

play21:37

[Musik]

Rate This

5.0 / 5 (0 votes)

Связанные теги
Dynamic ProgrammingComputational ThinkingOptimizationAlgorithmsEducational ContentProblem SolvingRecursionMemoizationEfficiencyReal-world Application
Вам нужно краткое изложение на английском?