So hi everyone, okay, so we are now in this subject, so data structure and algorithms, okay? So when we say data structure and algorithms, so we will be dealing those algorithms, so different algorithms that you should know, that you should be aware, okay, so for you to at least create, then understand. So firstly, you need to understand first those processes, okay, in order for you to create. a good algorithm for you to able to create those algorithms use for to apply those certain scenario, certain process that the system acquire and implement and also you can apply that in mobile applications, desktop applications, so web, and so on. So there's a lot of things that you can at least...
implement or apply those algorithms. So, but then, you should be aware on those process first, okay? So, for you to do the step-by-step, okay, process in doing the algorithm, okay? So, for now, we will be discussing this week 2 topic, so introduction to algorithm properties of algorithm notation for programs. Then, some simple programs.
Okay? So, for this learning outcome, so we have three learning outcomes. So, define an algorithm and its characteristics and then properties of algorithms and then lastly is transform an algorithm into a program that you can use, okay, in the future system, future applications. Okay?
So, In introduction to algorithms, so in computer science, okay, this is the field where we study about how to solve a problem effectively and efficiently with the aid of computers. So, a way of arriving at a solution from the problem domain is called algorithm. So, let's say, for example, if you encounter some problem, okay, so definitely there is an algorithm. that needs to at least solve that certain problem okay so in when you solve an algorithm or when you solve a problem that use that uses an application that is a computer so meaning you dealing you're dealing with those algorithm those process that you might use in solving those problem Necessarily for computer application, web, so mobile applications. Okay, so meaning you apply the algorithm.
Okay, so in our case, okay, because I'm a computer science graduate. So we are dealing with those different algorithms. Okay, so again for us to know how to develop the algorithm.
So we just need. to at least learn those step-by-step process in solving the needed algorithm. So, firstly, we will need to identify those problem scenario that we encounter during the process.
Let's say, for example, sa enrollment system, why we need to have an enrollment system. Okay? So, sabi nila, medyo matrabaho daw. Okay?
Hindi natatrack yung... Ito yung mga problem, ah. Hindi natatrack yung mga conflict schedule. Hindi natatrack yung mga...
yung students, kung sino yung mga naka-enroll. So, mahirap itrack. Definitely. Okay? When you do those...
Okay, manual process in... in enrollment. Okay? So, let's say, for example, ililista ko kung sino yung mga naka-enroll, one at a time, ililista ko lahat, and then saang subject naka-enroll, ano yung schedule. So, basically, masakit sa ulo.
Okay? So, if you do that, okay, medyo komplikado. Medyo masakit sa ulo. Okay? So, kaya nga...
Ginagawa ng system, kaya ginagawa ng process, ng computer system process, para at least mas maging maayos or organized. Okay, na nadedetect mo yung mga conflict, yung mga problem, okay, in those scenario, in those process na ang hirap, okay, ang hirap matrace yung... using the manual process. Okay? So, just like yung pen, pen and paper.
So, ililista mo lang. Okay? So, ang hirap po kasi malaman. Okay? Ang hirap mag-backtrack.
Ang hirap mag-trace. Paano pag... libo. Yung student mo. So, try to imagine, diba?
So, kaya nga, gumawa ng enrollment system para at least organize, nakatrack lahat. Okay? May kita mo na lahat doon.
So, integrate it, then, nakanetwork, and then, okay, kung online pa yan, mas okay. Kasi ang problem, when you do that online, okay, when you implement that online, so, ang daming risk is, Risky kasi yung security So kasi You need to protect those Datas of all Yung staff Yung personnels Faculty, admin Students, especially students You need to make sure that Those data Those data will be Or will not go to the hands of those hacker. Kasi pag nakuha nila yung mga data na yun, so pwede lang gamitin against us, against those students, maging threat.
So those scenarios, kaya nga, so medyo risky. when your system or application is being online. Okay?
But then, mas maayos, diba? Kasi you can enroll. Okay?
So, pwede ka mag-enroll. So, kahit wala ka dun sa school. So, using remote or network connection, internet connection. So, you can try doing that.
Okay? Also, In encoding of grades, we can also encode grades, those systems. So yung tinatawag na school automate. Pag school automate ngayon kasi usually yung mga school automate ngayon is lahat po sakop niya na.
Enrollment, yung grading. Okay, so faculty, yung deans, accounts, and then also yung admission, accounting, registrar, and so on. So lahat po.
Okay, so those are systems na medyo big. or mabigat-bigat na kasi it costs millions. Okay? So, that system, I think, is cost niya is 5 to 6 million.
Okay? So, anyway, so those are the... the process. Okay?
So, yun, enrollment. Ayun, lumawak na. Naging school automate na. Nakapokus nung una, nakapokus lang sa enrollment.
Then, apparently, so, since, you need to apply, okay, those systems in your company, so, nagkaroon na na school automate. Kasi, syempre, school. Okay? Pag school automate, so, lahat po andun na. Okay?
Yung organization naman, ibang organization, ibang company, ibang system. system naman yung i-handle. Okay? Or gagawin.
Then, so we have two major sub-fields of computer science. So, we have the design and analysis. Okay?
So, in designing. So, at least, there's a lot of things that we need to at least kumbaga set aside. Okay?
So, kailangan mo i-manage yung design. Okay? kailangan mong, okay, ah, kumbaga, mag-imagine ka.
Okay? Mag-imagine ka, ano yung mga design mo, ano yung mga content nung bawat form, okay, na gagawin mo. And then, those requirements needed, okay, so, those requirements needed in doing those, ah, or in applying the whole process. Kasi, eto yun, eventually, yung design na yun, okay, Okay, so alamin mo ngayon. Okay, again, titignan mo, check mo kung ano yung mga needed requirements.
So let's say for example, in enrollment system. Okay, so pag sinabing enrollment system, medyo malawak yan, medyo malaki. Okay, malaki ang sakop niyan. So design.
Okay, so ano ba yung magiging content ng form ko? Okay, let's say for example, enrollment official. Okay, ano yung mga, pag sinabing enrollment... enrollment official.
pwedeng ano yan, limited limited yung content nya unlike kay registrar kasi when we say enrollment system, indyan po si registrar sa registrar yung pinaka admin ok yung head ng registrar yun po yung pinaka-admin. And then, so yung registrar stop, ito yung account nila. Ito yung nakikita nila. And then, yung mga enrollment stop, so ito rin nakikita nila.
Medyo limited. Okay? So medyo, medyo limited yung bawat content na may kita ng bawat user. Okay?
So, kailangan natin alamin kung sino-sino yung gagamit. Okay? Para in that case, malaman natin kung ano yung bawat content ng bawat form nila. Okay?
Alam nyo naman yan, di ba? When we log in to a certain account, to a certain application. Okay? So, websites. Let's say, for example, so, limited lang yung content natin.
Just like Facebook. So, ito lang yung nakikita natin, di ba? So, unlike dun sa mga developer, dun sa mga admin, so, ito yung nakikita nila.
Kasi, di ba, they have the access. So, ayan. So, you need to at least know the whole process, okay, and then after that, analysis.
Okay? So, i-analyze mo, okay, yung bawat content, nung gagawin mo, design. So, kailangan ba ito?
Bakit kailangan ito? Okay? So, bakit ko kailangan tanggalin ito?
Bakit hindi ko kailangan ilagay ito? So, you need to at least balance and then analyze those things that you need to apply or implement in your system. So, hindi kayong basa-basa kasi nag-design, hindi yung basa-basa nag-program. So, you need to at least know those requirements needed okay, in order for you to create a system so firstly, identify or if there is a need to interview a personnel, so go ahead kasi in doing the interview you can get those requirements you can get those data you needed okay, o ito pala so magkakaroon ka ng idea okay, so ito pala yung kailangan ko po for this account. Okay?
So, just like in my case, pag gumagawa ko ng system, okay, let's say, for example, my student, nagpagawa ng thesis. Yan. Okay?
So, alamin ko muna lahat, okay, bago ko tanggapin. Okay? Kasi, hindi naman pwede tanggap ka ng tanggap ng thesis, ang papagawa ng system, hindi mo alam yung buong content.
Okay? So, tatanungin mo lang siya, pag, Okay? Ginagawa mo na yung system.
So, mahirap po yun, ha? So, pag gumawa ka ng system, bago po kayo gumawa, bago niya accept yung project na yun. Okay? So, bago niya accept yung project na yun.
So, you should be aware on those scenario, on those process, on those requirements needed. Okay? So, basically, those things, yun po yung pinaka-basic needs.
Okay? Basic requirements. Ano ba yung...
need. Bakit kailangan gawa ng system? So, pag-iisipan mo muna, evaluate mo muna.
Kasi ito yung problem. Ito yung mga ganyan, bla bla bla. In my experience, in my case, nalalaman ko ngayon kung gagawan ba or need ba talaga gawa ng system. So, ano ba siya? Websites ba siya?
Mobile apps lang ba siya? Desktop application lang ba siya? So, in those scenarios, those cases na pagka-interview ko dun sa nagpapag- gawa. Okay? So, nalalaman ko yung mga scenario behind that.
So, in that case, na-evaluate ko yung need na, ah, kailangan ng system to. Kailangan ng apps nito. Okay?
So, in those interview, okay, nalalaman mo kung need ba talaga. Okay? So, kailangan mo na mag-interview ka, kausapin mo yung involved, okay, dun sa project.
process na yun. Just like in enrollment system, okay, sino yung kakausapin mo dun? Siyempre, kakausapin mo yung registrar.
Ano yung mga ginagawa ng staff? Ano yung ginagawa ng registrar? Ay, yung pinaka-head nila. Okay, ano yung ginagawa?
So, ito yung mga content. Okay? Ito yung content ng registrar's stop.
Ito yung content ng admin. So, ito yung makikita ko. So, definitely, okay, so these are the needed content for each design, okay, for each process. So, in that case, nangalaman ko ngayon, okay.
So, ito pala yung meron. Let's say, for example, ano ba meron dun sa enrollment system? Okay, let's say, for example, enrollment, i-enroll ka ito. Yung student number mo, unang-una yun.
Pag-type ko yung student number mo, chinecheck sa database. If you are existing on that database, kailangan nag-exist ka dun. Kasi kung hindi... Baka hindi ka estudyante or baka hindi pa nalagay yung information mo dun sa database upon the enrollment.
Baka kailangan mo munang dumaan kay admission. Diba? So, si admission kasi siya yung unang-una. Siya po yung nagbibigay ng temporary ID, okay, temporary numbers, okay, for you to at least enroll. So, dun din, in-enter yung mga basic information, basic requirements na sinabit mo, okay, sa admission.
Then, before ka i-cater for enrollment, okay. Then, So, again, what is an algorithm? So, algorithm means process or rules for computer calculation.
Okay, an algorithm, so name for the 9th century version mathematician. Okay, algorithm. So, it's simply a set of rules for carrying out some calculation. So, either by hand or more usually on a machine.
Okay? So, we also have the Euclid's algorithm. most famous algorithm in history dates from well before the time of the ancient Greek. And then, we have also the Euclid's algorithm for calculating the greatest common divisor of two integers. So, most likely, there's a lot of algorithm exists.
So, pwede kang gumawa ng sarili mong algorithm. Ano bang ginagawa ng algorithm na ito? Let's say, for example, Okay?
So, in your case, itong algorithm na ito is pinaprocess niya, automatic niya pinaprocess yung mga request. So, let's say for example, mo nag-text sa, ang system mo is, let's say for example, Yung system mo, okay, pag malalaman ng student, okay, yung schedule niya. Let's say, for example, schedule niya or yung mga classes schedule niya.
Let's say, for example, Okay, itong student na to is naka-enroll sa ganito. Okay, nakalimutan ko yung reg form ko eh, di ba? O, pag minsan, ganun yung nangyayari. So, Most likely, ayan, yung, pwede ka mag-text sa system.
Okay? Kasi, sometimes, diba, nakakalimutan natin yung regform, nakakalimutan natin yung mga subjects, hindi tayo aware. Okay? So, yung system na yun, nagagawin mo, okay, can, at least, ah, search or let's say for example pag nag-text ka doon sa system na yun so ibibigay niya yung mga list of subjects mo. Okay?
So yung mga list of subjects mo so ito yung yung pinaprocess ni system. So, let's say, for example, tin-text mo, nag-text ka sa system, student number. Okay? And then, yung subject. So, ito yung keyword.
Okay? Subject, or enrolled subject, ito yung keyword mo. And then, student number.
student number, ititext mo sa system. So, yung system ngayon, automatic niya ibabato or ibigay sa'yo dun sa respondent. Okay?
Dun sa nag-send or nag-text dun sa system. So, automatic niya ibabato yun. Basta merong signal and then load yung SIM na ginagamit. Okay?
So, in that case, ang tawag mo doon is subject or enrolled subject request. So, yun yung algorithm mo. Diba? Kasi, nag-automatic siyang nag-reply ng subject schedule mo upon texting. Diba?
So, yun yung tawag mo ngayon. Yun yung algorithm mo. Okay? So, again, so, depende naman sa process ng algorithm.
Ano bang ginagawa niya? Usually, nakadepende kung anong ginagawa niya. Let's say, for example, data compression.
So, pag sinabing data compression, alam nyo po yung RAR or ZIP, di ba? Usually, yun po yung data compression. Let's say, for example, yung 1GB mo na file, o ZNIP mo, nilagay mo sa ZIP file, kina-compress niya po. Yun, kaya pansinin nyo, pag minsan, RAR, madalas, when you compress, let's say for example, 1 gig, nagiging sometimes 400 400 MB 500 MB or 600 MB. So, nakompress nyo natin yung data.
When you use or when you apply the RAR or yung ZIP. Pag inapply po natin yun. So, yun naman usually pag nagta-transfer kayo ng system. So, basically magpapag-apply ang ginagawa, nilalagay sa zip or sa RAR. Okay?
Para makompress po yun. Okay? Yun po yung algorithm.
Data compression. Okay? So, maraming data compression algorithm ang involved.
Okay? So, marami din. Let's say, for example, yung encryption, decryption. Marami rin klase ng encryption, decryption.
So, anong gagamitin mo? Andyan yung AES. Andyan yung SHA-1. So, So, Siya 2, siya 3. Okay. So, MD5.
Okay. So, yun po yung mga encryption algorithm. Okay. Hashing.
And hashing algorithm yung DES. Okay. So, a lot of things.
Okay. Daming algorithm. Okay.
So, kaya nga, it's up to you. Okay. When you develop or when you are planning to develop an algorithm. So.
pag-iisipan nyo o iisipin nyo kung saan nyo i-apply anong gagawin o anong gagawin ng algorithm na yun okay, kaya nga hindi basta-basta gumagawa ng algorithm so kailangan mong malaman yung bawat process okay, for you to create an algorithm okay so because if you have an idea on each process, definitely you can create a step-by-step process for you to create your algorithm, for you to solve the problem. In this case, when you solve the problem, with your step-by-step process, a set of algorithm, set of codes, so you can have your final version of algorithm. Okay? So, yun po.
Then, an algorithm is defined to be a sequence of steps which, if followed, accomplishes a particular task. Yes? Sequence of steps. Okay? Magkakasunod po yan.
Step 1, ito yung gagawin. Step 2, step 3, and so on. Okay? So, ito yung mga gagawin.
Okay? So, basically, sequence of steps. Then, every algorithm must satisfy the following criteria. Okay, consumes zero or more inputs, okay, then produces at least one output, then we have the definiteness, and then finiteness, and then effectiveness. Okay?
So, properties of algorithms, so an algorithm must possess the following properties, okay? So, when we say finiteness, the algorithm must terminate with In infinite time, so infinite number of steps. So, let's say for example, nagawa niya na. Okay, nagawa niya na yung pinapagawa.
Okay, so dapat mag-determinate na yung program, titigil na. Or, depende po yan. Okay?
Let's say, for example, kasi pag sinabi natin mag-determinate yung program, o titigil na, mag-i-stop na pa siya. Okay? So siguro, okay, in other system, so it can be... But, the other one is because the system is running.
Just like the previous one. When you request your enrolled subject, you will just text. So, it will be given to you. So, that's a continuous process.
So, it was given to you. And then, from there, the program will not terminate. It will continue.
It will check again if you have texted. Okay? So, it's check nyo ulit kung may nag-text. Okay?
Pag may nag-text, ipaprocess nyo ulit. Okay? After processing, ayun, bigay ulit.
Then, titignan nyo ulit. Ayun yung mga, yung continuous process. Okay? Then, Definiteness and steps enumerated must be precise and ambiguous. Ibig sabihin, maayos.
Maayos po yung steps. Maayos yung gagawing process. Para click.
Clear. Okay? So, hindi yung gumagawa kayo ng program, gumagawa kayo ng process nyo, gumagawa kayo ng algorithm, hindi ganun kaayos.
So, definitely, medyo magulo yung magiging program nyo. Okay? Effectiveness.
Each step must be easily convertible to a code. Yeah. Kaya nga nagkakaroon ng pseudocode.
Okay? O. Let's say, for example, isusulat mo ang kayaan yung gagawin. Paano ba gagawin? Okay, parang ganito.
So, ikikwento mo muna. Okay, ikikwento mo muna yung senaryo. Ganito. Yung enrolled subject, paano ko makita?
kakakuha ng enrolled subject ko. Nakalimutan ko yung CUR. Di ba?
Or yung registration. Nakalimutan ko. Okay? Eh, yung proof mo, kailangan ng proof na doon ka talaga. Naka-enroll.
Eh, syempre, CUR yung kailangan. Magte-text ka lang. So, ganito, ang ikikwento mo, so, again, yung pseudocode is a English-like statement.
Ikikwento mo ngayon kung ano yung mangyari. Okay? The student will text the system and then if the system The system will check if the student is exist. And then, if the student is exist on the database, the system will check if the student is enrolled on that subject. Okay?
Pag-enroll. or if the student is enrolled on that semester. Pag enrolled yung student, okay, i-check niya kung ano yung yung mga subjects. Okay? The system will check what is or what are the subject of the student.
Ayan, kunento mo. Okay? Ngayon, i-convert mo yan into code. Okay, so, ayan, nakwento mo, okay, yung process, ayan yung process, ayan yung gagawin, so, effective na, so, i-convert mo nga yung to code.
And then, input algorithm must take zero or more input. So, definitely, mag-trigger yan, ano ba yung magiging input mo para mag-trigger? Okay?
When you... When you execute the program, okay, so, in-start mo na. Okay, anong input mo?
Yung text. Okay, yung keyword. Ito yung keyword.
Kailangan makita mo yung keyword tsaka yung student number niya. Okay, ayun po yung input mo. Ayun yung mag-trigger. Okay, para mag-process. Trigger, ah.
Then, automatic na siya mag-process. So, keyword, tapos yung student number. Sabay text. Pagka-send.
Yun na yung trigger mo. Yun na yung input mo. Okay. Okay, paprocess ngayon yung system. Automatic po yun, ha?
Then, output mo, so, magpuproduce siya ngayon. Ibigay niya yung subject. Okay?
Ibigay niya po yung subject. So, for you to at least have your result, have your output. Okay? Then, Okay, notation for programs. Decide how to describe our algorithm.
So, paano di describe? Explain mo. Then, for you to come up with your name. Okay, specify our algorithms by giving a corresponding program. So, it does not really matter which will structured language the reader prepares.
And then, use phrases in English in our programs. This makes for simplicity and clarity. Okay, then let's say for example, in this case, okay, we have here some simple examples, okay, so designing algorithm for a problem. So let us consider the problem of verifying a given. If a given...
number n is a prime as an example. So, the possible ways to solve this problem are as follows. Okay?
So, 3 different ways to solve a problem. Okay? Example 1.1 algorithm 1, check for prime.
Okay? So, input a number n Output number n is a prime or not Okay, method Okay, for all k is equal to 2, 3, 4 Okay, n minus n So, if Okay, so ito yung pseudocode po ito ha If n mod k less than equal to 0 Or less than Greater than 0 Then n is a prime number So, else it is not a prime number So, ito yung algorithm n So, ito yung example Then, ano? Another example 2. Okay, or another algorithm 2. Okay, check for prime, input the number, number n is a prime or not. Okay, for all, k is equal to 2, 3, 4, n, okay, over 2, okay.
So, kasi kanina, n, n minus 1, okay, so yan po. So, n minus 1, ngayon, okay, n over 2 or divide by 2. Then, if n mode case, let's see. less than, greater than 0, then n is a prime number.
Else, it is not a prime number. Algorithm ends. Okay? Then, another algorithm. Okay?
So, check for prime. A number n, number n is a prime or not. Okay?
So, Method for all k is equal to 2, 3, 4. So, square root n. So, another method. So, if n mod k greater than 0, then n is a prime number.
Else, it is not a prime number. So, ibig sabihin, every problem has a different solution, has a different algorithm to do. Kaya nga in my 10 years of teaching, nakikita ako, Okay, nakikita ako or marami na ako nakita na case na yung problem or yung solution is magkakaiba.
Okay, magkakaiba talaga yung thinking ng bawat gumagawa. ng bawat student. Okay?
So, kagaya nyan. Okay, may option ako. Okay?
Or, may solution ako. Ito yung solution ko. Okay?
And then, nasagot ko. Ito yung solution ko. Ito yung algorithm. Kategoritem ko.
Isang student, na sagot niya, ito yung solution niya. Nung tinignan ko, yung code, kinumpare ko, magkaiba kami. Then, another student, ito yung solution niya. Tinignan ko yung code, magkaiba rin. Okay?
Magkakaiba kami tatlo. Okay? So, ganun po.
Okay? So, again, magkakaiba ang solution for each problem when you develop a system, when you develop an algorithm. Kaya may option A, option B, option C, and so on.
Okay? So, again, ano yung mas okay? O, magpareis lang naman ng output eh.
Diba? So, ayun po. Okay?
Again, so para, basta mailatag mo lang or maayos mo lang yung step-by-step process, ito yung, okay, magiging maayos yung program mo. Okay? Then, Puro pares naman na yan. Okay. So, summary.
So, in this lesson, so we have introduced algorithms, a glimpse of all the phases we should go through when we study an algorithm and its variation was given. So, in the study of algorithms, the problem is, Process of designing algorithms, validating algorithms, analyzing algorithms, coding the design algorithms, and then verifying, debugging, and studying the time involved for execution were presented. Okay, so again, medyo mahirap gumawa ng... ng algorithm. But then, if you're eager to, okay, you can produce one.
Okay? Hanggang sa dumami na, dalawa, tatlo, and so on. Hanggang sa makagawa ka, hanggang sa makapag-develop ka na, ng buong system.
Okay? Hanggang sa maintindihan mo na yung flow ng system na yun. Makita mo pa lang, yan, makita mo lang yan, short glimpse. Okay? Alam mo na yung gagawin, okay?
Let's say, for example, may magpagawasin ng system. Okay? Kinikwento sa'yo, alam mo, mo na yung gagawin mo. Nami-visualize mo na, na-analyze mo na, possible pala. Okay?
So, yun po. Okay? So, that's the end of my presentation.
So, hope you have learned a lot. Okay? So, thank you for listening.