Chapter 2

4 Pages

Information Technology Management
Course Code
ITM 200
Vikraman Baskaran

This preview shows page 1. Sign up to view the full 4 pages of the document.
Khushi Sharma Thursday May 3 , 2012 Chapter 2 Algorithms and Programs -programming task can be divided into 2 main phases:  Problem Solving Phase: develop the algorithm in the form of pseudo-code and flow charts  Implementation Phase: implement the program in a programming language Problem Solving: -programming is all about solving problems -program is just a set of instructions that describes how to solve a particular problem, written in a language that a computer can understand -there are usually 4 steps in solving a problem:  Understand the problem  Work out a plan  Sort out the details  Test and evaluate -same thing also applies to writing a program -understanding the problem is a vital step in solving a problem, you need to ask  What information do we know? (most important step)  What do we want to happen?  What can one lead to the other? -writing a program is very time consuming and if it turns out that the program does not do what the client want it to do, then the process of re writing or changing the program can be extremely expensive  Therefore best solution is to understand it fully before starting to develop a program -there are always many routes available to reach the destination or to solve the problem, therefore you should think about all the possible solutions and choose the best one The Pizza Eater’s Problem: -consider the problem solving process as equally important to a programming problem; the desire to eat pizza -you will be amazed by the range of questions that you consider even on something as simple as eating pizza -Examples of some questions:  You know you want pizza but when?  Are you desperately hungry? Or can you wait for a while?  Do you prefer to taste homemade pizza?  Do you have ingredients?  If not, can you be bothered to get them from the store?  Do you have pizza in the freezer?  Do you like near a take away? Or do they deliver?  Do you want thin or thick base?  Is it just for you? Or for your friends as well? -you should brainstorm in the above manner until you fully understand the problem and have some alternatives strategies for solving it Khushi Sharma Thursday May 3 , 2012 Algorithms: -set of instructions of solving problem; consists of the actions to do and the order in which to do them -algorithm should be at least;  Complete: cover all parts  Unambiguous: there is no doubt about what it does  Deterministic: only one possible result  Finite: it should finish -examples of algorithms are:  Set of directions for getting from one place to another  Recipe  Instructions you learned about how to do long multiplication  Set of instructions for solving a Rubik’s Cube -algorithm is a solution to a problem written in such a way that if its instructions are followed blindly, problem will be solved -actions to be performed and the order in which they should be performed must be clearly given -writing algorithm involves not just being able to solve the problem but knowing exactly how you solved it so that you can write it down First Write the Algorithm -computer program is an algorithm -it is often easier to write the algorithm using a mixture of English and the programming language constructs, this is called a pseudocode -pseuducode algorithm can be tested and then translated into the programming language when you are happy then it is correct Subprograms: -algorithm also illustrates another important feature found in the computer program; which is called “subprograms” -advantages of subprograms:  Main algorithm will be more compact/succinct  Main algorithm will be easier to understand as the sub-algorithm are not cluttering up  Sub algorithm can be used over and over again (reuse) Reuse of Algorithms: -sometimes an instruction needs very little refining -sometimes each more abstract instruction is refined into several more detailed instructions, however sometimes it turns out that an instruction can be implemented by simply reusing an algorithm which you already have available -idea of reuse is extremely important in computer programming, most modern programming languages come with extensive libraries of pre-written subprograms (algorithms) which may be used by programmers in their own programs -library that comes with the Java programming language is called the “Applications Programming Interface (API)”  Java API is more s
More Less
Unlock Document

Only page 1 are available for preview. Some parts have been intentionally blurred.

Unlock Document
You're Reading a Preview

Unlock to view full version

Unlock Document

Log In


Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.