Full transcript of “Berpikir Komputasional - Menerapkan algoritma pencarian”. Click a timestamp to open the video at that moment. Need another video? Use the YouTube transcript generator.
0:01 Assalamualaikum warahmatullahi wabarakatuh Healthy greetings to all friends On this occasion we will discuss the material of computational thinking in the second chapter, namely applying the search algorithm, well, pay attention to the following case here I have 12 books that I have arranged in such a way, well then friends are asked to look for a book with the title one kiss art Can friends find the book, yes friends found the book
0:47 in book 7, well the question is Can friends describe the process that occurs, the process How friends found the book Well to answer the question, let's discuss the following material, let's start from the concept of the search itself, well, search is the process of finding certain elements or objects from several given elements, the search is declared successful if the searched element is found, if not, the search is
1:32 declared unsuccessful, well, in the 10th grade Informatics book, it is stated that when doing a search, you must find an object or object that meets certain criteria from a set of other objects or objects, if an object meets certain criteria, then the data is found, but if we have searched until or throughout the object and do not find a single object that meets the criteria we need, then it can be said that the search was unsuccessful in
2:23 finding a value but it has been mentioned yes certain value from a set of data with the same data type So if we do a data search where we do the search the type or type must be the same if the text is all text if the numbers are all numbers well for example if we want to search for a name in a list of names Well then this list of names must contain names in text form not in number form in
3:11 different types well so when we want to search for numbers in a list of numbers then this list of numbers yes contains numbers not mixed there are numbers there are text there are punctuation marks and so on well then How do we find a value earlier Well the process is by comparing the value being searched for with the existing data so if we go back to the previous case How can friends find a book with the title one case actually the process that occurs is friends compare the title of the book [Music] 1 2 3 and so on with the
4:00 title of the book we are looking for So so we compare the title of the book One Piece or with the title of the first book the same not the same as the title of the second book not the same third not the same fourth not the same fifth not the same sixth not the same 7th the same finished So so actually here the process that occurs is comparing the value being searched for with the existing data well but this problem becomes The more complex the more complicated when the existing data is bigger Let's
4:48 try to find data from 100 existing data if 1000 existing data 100,000 existing data Well then this becomes a complex problem Well therefore we need a strategy from a strategy that this strategy is expected to be able to search quickly, precisely and efficiently we are fast means the process can be done quickly precisely that if all the data is there then it can be found if it is condensed that is not there
5:34 then it is efficient requires few resources to do that Well what is the strategy Well here we have two algorithms algorithms that can be used to do or solve search problems namely linear search or sequential search and binary search Let's discuss one by one well linear search or sequential search well he is this search is a search with a search method comparing the data being searched with each data in the list 1/1 can start from the front or can start
6:20 from the back randomly is still possible but not recommended the important thing is to compare it 1/1 well the search will be carried out until data is found that matches the data being searched if not the search will be carried out until the end of the data well if until the end the data is not found then the magnitude declared unsuccessful well generally this algorithm is used to search from an unordered list Well if it is sorted it can be done but it is not effective we are not effective there is another algorithm
7:06 that is more effective to search in a list that is already binary search well Let's discuss this linear search algorithm the first is start Then the second Determine the data being searched 3 compare the data being searched with the first data well If the data being searched is the same as the data that was compared earlier then the data is found then finished if not then repeat Step three with the next data second third data and so on until the end of the data if all the data has been compared and no matching data is found then the data is not found
7:55 7 finished Well for more details Let's try to apply this linear search algorithm Well here I have prepared a list of random numbers here yes friends Yes handsome there are 13 48 74 15 25 and 11 well here I want to find a number that is 15 well Let's use the linear search algorithm to leave this problem the first is
8:41 I will compare the first number in the list 13 with 15 is not the same then I continue to the second number which is 48 is not the same suggest the third number which is the number 7 is still not the same Continue to the fourth number which is 4 compare it with 15 still not the same continue to the fifth number there 15 Well, only here we find the number
9:33 Well, so here in this linear search algorithm or sequential search we compare one by one compare 13 with 15 48 with 15 is the same 7 with 15 is not the same 4 with 15 is not the same 15 with 15 is the same well hopefully this explanation can be accepted yes friends yes let's continue to the second algorithm which is binary search well this binary search is also known as half interval search Well
10:20 there are the words half interval half interval well how does the concept of video search is done by comparing the value being searched for with the value in the middle or median then If the value does not match then some of the data in the list will be eliminated data where the data that is impossible for the value we are looking for is in it then the process will plan in the remaining half in the same way Until when well this process is repeated until the data is found or until it is no longer possible to divide if it is no longer possible to
11:07 divide but the value is not found then the search is declared unsuccessful well ordinary binary search used to search for data from a set of data that has been sorted Let's see the algorithm first is to start second Determine the data being searched 3 compare the data being searched with the data in the middle round down yes if the data being searched is the same as the data in the middle or the media means the data is found finished
11:52 well If the data being searched is larger If the data being pulled is larger then eliminate the data that is smaller than the median and the median itself If the data being searched is smaller then eliminate the data that is larger than the median and the median itself well repeat step 3 for the remaining data until the data is found or until it is no longer possible to divide the 8th step is finished
12:38 Well for more details Let's practice this binary search algorithm Well here I already have 10 numbers there are 10 numbers that I arrange from smallest to largest well Then to make it easier for me to do or apply this binary search algorithm for each number for each of these numbers I give a sign I give a sign is this or
13:26 index I usually call it index 1 [Music] 4 5 6 7 8 9 10 Well here I want to search for numbers Okay let's start the first step first step How are the steps The first is to compare the data sought with the median. Now how do we determine the media
14:12 by adding the first index with the last index then divided by two. One plus 10 divided by two equals 5 and a half. Okay, I rounded it up to 5. The fifth data is 27. Compare the number 27 with the number 31. Well, it turns out that the number 31 is greater than 27, then eliminate the data that is smaller than the median and the
14:57 median itself so that here we only have the numbers 31 33 35 42 45. This is the sixth index 7 8 9 10. Now, next we do the same thing. The second step is to determine the middle value. Determine the median value. The median is 6 plus 10 divided by two. 16
15:42 divided by 2 8. Now, what is the 8th index? The index 8 is 35. Here, 35 = 31. It turns out that 31 is smaller. There is 31 that is smaller. So, eliminate the numbers above the median and the median itself so that here we only have the
16:29 data left, namely 31 and 33. With the index 31, that is the index. sixth 33 index to well how do we do the next same step that is looking for the media Well here 6 + 7 /2 well 13 divided by two 12 and a half sorry 6 and a half 13 divided by two 6 and a half we round it to 6
17:20 well the data 6 is 31 here we compare the 6th data which is 31 with the data we are looking for which is 31 Sir it turns out the data was found Well that is the explanation for binary search hopefully it is clear enough
18:07 Well for another example friends can see on the next slide Well here there is data there are 10 numbers arranged in order also here looking for number 22 the steps are the same look for the middle value then eliminate look for the middle value eliminate until from the surface or until it is no longer found or until it can not be done anymore sheep well at the next moment there is also another example there we are looking for the number 23 from 10 numbers arranged from smallest to
18:55 largest the steps are the same look for the middle value then compare eliminate look for the middle value compare then eliminate until the data is found well The conclusion is that the search algorithm prevents you from having to look at a lot or all of the data to find the information we are looking for, so by using an algorithm using a search strategy, our search algorithm does not need to look at all the data, we don't need to look at all the data, we can use a certain strategy or method
19:42 so that we only focus on what we are looking for. So that is the discussion of computational thinking material in the second chapter, namely applying search algorithms, hopefully it is useful, wassalamualaikum warahmatullahi wabarakatuh