50 likes | 76 Views
Explore the formal mathematical properties, applications, and linguistic realizations of algorithms in computer science. Understand the design, efficiency, and implementation of algorithms to solve problems. Dive into the central premise of computer science and the definition of algorithms through practical examples.
E N D
Department of Computer and Information Science,School of Science, IUPUI Models of Computation - Algorithms CSCI 230 Dale Roberts, Lecturer Computer Science, IUPUI E-mail: droberts@cs.iupui.edu
Algorithms • Computer Science is a study of algorithms, which includes: • their formal mathematical properties • their hardware realizations • their linguistic realizations • their applications • Therefore, our task is to: • design and develop algorithms to solve problems • study the algorithms to see if they are corrector efficient • design and build computer systems which can execute these algorithms • design programming languages and translate algorithms into these languages
Definition of Algorithm Central Premise of Computer Science: “If we can specify an algorithm for a problem, then we can automate its solution” • Definition of an Algorithm • consists of unambiguous & computable operations • produce a result • halt in a finite amount of time. (Some scientists add a restriction that the algorithm must halt in a reasonable amount of time.)
Examples of Algorithm • A good example of an algorithm • A recipe for cherry pie • step 1: mix 1 cup sugar, ¼ cup flour, ¼ tsp. salt • step 2: stir in ½ cup juice from the cherries • step 3: Cook & stir over medium heat until thick • step 4: Add 3 cups canned, pitted red cherries • step 5: Add 1 tblsp. butter & 4 drops almond extract • step 6: Make pie crust & place in a 9 inch pie plate • step 7: Fill crust with cherry mix & top with 2nd crust • step 8: Bake at 450 oF for 10 mins. then 350 for 45 mins.
A bad example of an algorithm • How to use shampoo XYX • step 1: Wet hair • step 2: Lather • step 3: Rinse • step 4: Repeat • What is wrong with algorithm?