Chapter 2. Algorithm Discovery and Design. Objectives. In this chapter, you will learn about: Representing algorithms Examples of algorithmic problem solving. Introduction. This chapter discusses algorithms and algorithmic problem solving using three problems: Searching lists
Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.
In this chapter, you will learn about:
Natural Language - too verbose, ambiguous and lacks structure.
Formal programming languages – forces low level details, punctuation, grammar syntax.
Pseudocode - English like statements, very readable, no grammatical rules, etc., is easily translated into a programming language.
to give precise meaning to a word or phrase
Expressed in a High-Level Programming Language
Set the value of “variable” to “arithmetic expression”
where a Variable is a named storage location that can hold a data value
Set the value of c to a+b
or Add a and b to get c
Get values for “variable1”, ‘variable2”,...
Get a value for r, the radius of the circle
Print values for “variable1”, “variable2”,...
Print the value of Area
print x times 100
Pseudocode ( Counting Loop – For Loop)
Repeat step I to step J until the “True/False” condition becomes true
Step I: operation
Step J :operation
Pseudocode ( While loop)
Repeat while a “True/False” Condition is false
End of the loop
Pseudocode (Repeat Until Loop)
Repeat until a “True/False” Condition becomes true
End of the loop
set s to s + aj
set j to j - 1
set k to k + 1
until k > n
A Simple looping problem
Multiply two numbers using repeated addition
move pointer to next element
Pattern matching in text
Patterns in genes