280 likes | 526 Views
DCT 1123 PROBLEM SOLVING & ALGORITHMS. INTRODUCTION TO PROGRAMMING. Subtitle Here. COMPUTER PROGRAMMING CONCEPTS PROBLEM SOLVING OVERVIEW ALGORITHM OVERVIEW (PSEUDOCODE & FLOWCHART). CONTENTS. What is Computer Programming?.
E N D
DCT 1123PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING
Subtitle Here COMPUTER PROGRAMMING CONCEPTS PROBLEM SOLVING OVERVIEW ALGORITHM OVERVIEW (PSEUDOCODE & FLOWCHART) CONTENTS
What is Computer Programming? • Writing software, computer programs, is describing how to do something. • It is a lot like writing down the steps it takes to do something - a process. • So, writing a computer program can be like composing music, like building a house, like creating lots of stuff.
Programming Language • Just like we have many different languages in use throughout the world for us humans to communicate with, there are different languages that we use to communicate with a computer. • Computer languages are used to tell the computer what to do, you instruct it.
Programming Language • We need a language to communicate with a computer. • Computer languages are used to tell the computer what to do, you instruct it. • Once it is written, the programmer uses a compiler to turn it into a language that the computer can understand. • Most software written today is using high level language such as C++, JAVA and etc.
Top Programming Language Rank http://jacobian.web.id/2010/11/14/java-and-c-top-programming-language-rank/
What is Problem Solving ? • The process of working through details of a problem to reach a solution. • Problem solving may include mathematical or systematic operations and can be a gauge of an individual's critical thinking skills.
Algorithm Overview • An algorithm is like a recipe; it lists the steps involved in accomplishing a task • In a programming, it is a set of detailed, unambiguous and ordered instructions developed to describe the processes necessary to produce desired output • Written in simple English
Algorithm Overview • For example, if you want to instruct someone to add up a list of prices on a pocket calculator, you might write: • Turn on calculator • Clear calculator • Repeat the following instructions • Key in ringgit amount • Key in decimal point • Key in cents amount • Press addition (+) key • Until all prices have been entered • Write down total price • Turn off calculator
Important Properties of Algorithms • Correct • always returns the desired output for all legal instances of the problem. • Unambiguous • Precise • Efficient • Can be measured in terms of • Time • Space • Time tends to be more important
Pseudocode • Pseudocode & flowcharts are popular ways of representing algorithms • Easy to read & write and allows programmer to concentrate on the logic of the problem • Using structured English
How to Write a Pseudocode • Statements are written in simple English • Each instruction is written on a separate line • Keyword & indentation are used to signify particular control structures • Each set of instructions is written from top to bottom, with only one entry and one exit • Groups of statements may be formed into modules, and that group given a name
Flowchart • Flowchart is an alternative method of representing algorithms • It is popular because they graphically represent the program logic through series of standard geometric symbols and connecting lines
Flowchart Symbols Terminal Symbol Indicates the starting or stopping point in the logic. Every flowchart should begin and end with a terminal symbol. Input / Output Symbol Represents an input or output process in an algorithm, such as reading input or writing output
Flowchart Symbols Process Symbol Represents any single process in an algorithm, such as assigning a value or performing a calculation Predefined Process Symbol Represents an input or output process in an algorithm, such as reading input or writing output
Flowchart Symbols Decision Symbol Represents a decision in the logic involving the comparison of two values. Alternative paths are followed, depending on whether the decision symbol is true or false Flowlines Connect various symbols in a flowchart, and contain an arrowhead only when the flow control is not from top to bottom or left to right
Sample Pseudocode & Flowchart Input letter If letter is ‘M’ Display ‘Malaysian’ Else Display ‘Foreigner’ End
REFERENCES • http://www.yourdictionary.com/programming • http://www.businessdictionary.com/definition/problem-solving.html • http://www.howstuffworks.com/c1.htm • http://visual.ly/history-programming-languages