Intro to
Algorithms &
Pseudocode
C o a c h F r u L o u i s
Tech|Career|Inspiration
Programming Basics
2
Agenda
@Coachfrulouis
Tech|Career|Inspiration
02. What is pseudocode? ( With examples)
01. What is an Algorithm?(With examples)
03. Why is Pseudocode
Useful?
04. Possibilities… Agenda
3
Alien: Write a program that allows
users to check whether a number is
even or odd.
You: Huhhhh?
4
You: Huhhhh?
5
Problem Solving in
the Computer world
 Algorithms
 PseudoCODE
6
ALGORITHM:
A set of rules that must be followed
when solving a particular problem.
You: Huhhhh?
Input
Set of
Rules
Output
7Party Response Algorithm!
You: Huhhhh?Definitely
Going
Any
Girls
Won’t Go
Party Invitation
Will
Amy
Go?
Won’t Go
Do I
have a
ride?
Won’t Go
A set of rules to
solve problems.
Usually Deterministic
No
No
No
Yes
Yes
Yes
8
$Examples
3 Mod 2 = 1
4 Mod 2 = 0
5 Mod 2 = 1
6 Mod 2 = 0
7 Mod 2 = 1
Alien: Write a program that allows users to
check whether a number is even or odd.
You: Huhhhh?
ODD
EVEN
ODD
EVEN
ODD
9
PSEUDOCODE:
Pseudocode is step-by-step written
outline of your code that you can
gradually transcribe into the
programming language.
You: Huhhhh?
10
FOR EACH current Number (X) in the list we see
X mod 2 = Y
Check IF Y == 0 THEN it’s EVEN
$Algorithm:
A set of rules that
must be followed
when solving a
particular
problem.
LOOP through each number in the list
Get LIST of numbers
ELSE Check IF Y == 1 then it’s ODD
$Pseudocode
END the program
11
PSEUDOCODE IS USEFUL:
1. To describe algorithm should
work
2. To explain a computing process
to less-technical users
3. To design code in a group
setting.
You: Huhhhh?
12
13Key Programming Concepts
You: Huhhhh?
• Loops
• Conditionals
• Iterations
• And more…
Deterministic vs Non-deterministic Algorithm.
Many Types of Algorithms
• Simple recursive algorithms
• Backtracking algorithms
• Divide and conquer algorithms
• Dynamic programming algorithms
• Greedy algorithms
• Branch and bound algorithms
• Brute force algorithms
• Randomized algorithms
Thanks
Tech|Career|Inspiration
F I N I S H

Intro to Pseudocode and Algorithms | Problem Solving in Computer Science

  • 1.
    Intro to Algorithms & Pseudocode Co a c h F r u L o u i s Tech|Career|Inspiration Programming Basics
  • 2.
    2 Agenda @Coachfrulouis Tech|Career|Inspiration 02. What ispseudocode? ( With examples) 01. What is an Algorithm?(With examples) 03. Why is Pseudocode Useful? 04. Possibilities… Agenda
  • 3.
    3 Alien: Write aprogram that allows users to check whether a number is even or odd. You: Huhhhh?
  • 4.
  • 5.
    5 Problem Solving in theComputer world  Algorithms  PseudoCODE
  • 6.
    6 ALGORITHM: A set ofrules that must be followed when solving a particular problem. You: Huhhhh? Input Set of Rules Output
  • 7.
    7Party Response Algorithm! You:Huhhhh?Definitely Going Any Girls Won’t Go Party Invitation Will Amy Go? Won’t Go Do I have a ride? Won’t Go A set of rules to solve problems. Usually Deterministic No No No Yes Yes Yes
  • 8.
    8 $Examples 3 Mod 2= 1 4 Mod 2 = 0 5 Mod 2 = 1 6 Mod 2 = 0 7 Mod 2 = 1 Alien: Write a program that allows users to check whether a number is even or odd. You: Huhhhh? ODD EVEN ODD EVEN ODD
  • 9.
    9 PSEUDOCODE: Pseudocode is step-by-stepwritten outline of your code that you can gradually transcribe into the programming language. You: Huhhhh?
  • 10.
    10 FOR EACH currentNumber (X) in the list we see X mod 2 = Y Check IF Y == 0 THEN it’s EVEN $Algorithm: A set of rules that must be followed when solving a particular problem. LOOP through each number in the list Get LIST of numbers ELSE Check IF Y == 1 then it’s ODD $Pseudocode END the program
  • 11.
    11 PSEUDOCODE IS USEFUL: 1.To describe algorithm should work 2. To explain a computing process to less-technical users 3. To design code in a group setting. You: Huhhhh?
  • 12.
  • 13.
    13Key Programming Concepts You:Huhhhh? • Loops • Conditionals • Iterations • And more… Deterministic vs Non-deterministic Algorithm. Many Types of Algorithms • Simple recursive algorithms • Backtracking algorithms • Divide and conquer algorithms • Dynamic programming algorithms • Greedy algorithms • Branch and bound algorithms • Brute force algorithms • Randomized algorithms
  • 14.