pseudo code - manalhelal.com · what is pseudo code high level and informal set of instructions...

52
Pseudo Code

Upload: others

Post on 22-Jun-2020

24 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Pseudo Code

Page 2: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

What is Pseudo Code� High level and informal set of instructions used to

describe an algorithm� NOT a programming language� Used to plan programs (Usually the next step after flow

chart design)� No standards

� Everyone does it their own way

Page 3: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Variable Expression<VARIABLE NAME> = < EXPRESSION>

Page 4: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Variable Expressionx = 5

y = 10

z = x + y

a = ( z + x) * ( z + y)

Page 5: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Function ExpressionFunction < FUNCTION NAME> (< ARGUMENTS>)

{

<INSTRUCTIONS>

Return < VALUE>

}

Page 6: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Function ExpressionFunction Power ( X, Y)

{

C = 0

A = 1

< DO POWER PROCESS >

Return A

}

Page 7: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Call Function<FUNCTION NAME> ( < ARGUMENTS> )

Page 8: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Call FunctionBASE = 3

EXPONENT = 4

ANSWER = Power(BASE, EXPONENT)

Page 9: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Decision Statement� If/Else Decision

� A decision rendered by Boolean expressions that follow a logical flow of conditions

� IF something is true, do something

Page 10: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Decision StatementIf (<CONDITION>){

<INSTRUCTIONS>}Else If (<CONDITION>){

<INSTRUCTIONS>}Else{

<INSTRUCTIONS>}

If (<CONDITION>){

<INSTRUCTIONS>}Else{

<INSTRUCTIONS>}

If (<CONDITION>){

<INSTRUCTIONS>}

Page 11: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Decision StatementIf (<CONDITION> && <CONDITION>){

<INSTRUCTIONS>}

If (<CONDITION> || <CONDITION>){

<INSTRUCTIONS>}

If (!<CONDITION>){

<INSTRUCTIONS>}

If (<CONDITION> || <CONDITION> && <CONDITION>){

<INSTRUCTIONS>}

If (<CONDITION>){

If (<CONDITION>){

<INSTRUCTIONS>}

}

If (<CONDITION> || (<CONDITION> && <CONDITION>)){

<INSTRUCTIONS>}

Page 12: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Decision Statement� <CONDITION>must be a YES or NO expression

� Example: If ( < Does X = Y? > )

Page 13: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Decision StatementBASE = 3EXPONENT = 4ANSWER = Power(BASE, EXPONENT)If (ANSWER > 10){

PRINT “ANSWER is greater then 10”}Else If (ANSWER >= 5 && ANSWER <= 9){

PRINT “ANSWER is between 5 and 9”}Else{

PRINT “ANSWER is less then 5”}

Page 14: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Looping (While)While (< CONDITION>)

{

<INSTRUCTIONS>

}

Page 15: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Looping (While)Function Power (X, Y)

{

C = 0

A = 1

While (C < Y)

{

C = C + 1

A = A * X

}

Return A

}

Page 16: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Looping (Do-While)Do

{

<INSTRUCTIONS>

}

While (< CONDITION>)

Page 17: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Looping (Do-While)X = 1

Y = 10

Do

{

PRINT X

X = X + 1

}While (X <= Y)

Page 18: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Looping (For)For (< START EXPRESSION>;< CONDITION>;< ITERATION EXPRESSION>)

{

<INSTRUCTIONS>

}

Page 19: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo Code: Looping (For)Y = 10

For (X = 1; X <= Y ; X++ )

{

PRINT X

}

Page 20: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 1LIST[1] = 2LIST[2] = 0

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 21: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 1LIST[1] = 2LIST[2] = 0

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 22: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 1LIST[1] = 2LIST[2] = 0

i = 0LENGTH = 3

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 23: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 1LIST[1] = 2LIST[2] = 0

i = 0LENGTH = 3(0 < 2) = YES

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 24: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 1LIST[1] = 2LIST[2] = 0

i = 0LENGTH = 3(1 > 2) = NO

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 25: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 1LIST[1] = 2LIST[2] = 0

i = 1LENGTH = 3

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 26: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 1LIST[1] = 2LIST[2] = 0

i = 1LENGTH = 3(1 < 2) = YES

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 27: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 1LIST[1] = 2LIST[2] = 0

i = 1LENGTH = 3(2 > 0) = YES

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 28: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 1LIST[1] = 0LIST[2] = 2

i = -1LENGTH = 3(2 > 0) = YESTEMP = 2

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 29: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 1LIST[1] = 0LIST[2] = 2

i = 0LENGTH = 3

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 30: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 1LIST[1] = 0LIST[2] = 2

i = 0LENGTH = 3(1 < 2) = YES

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 31: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 1LIST[1] = 0LIST[2] = 2

i = 0LENGTH = 3(1 > 0) = YES

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 32: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 0LIST[1] = 1LIST[2] = 2

i = 0LENGTH = 3(1 > 0) = YESTEMP = 1

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 33: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 0LIST[1] = 1LIST[2] = 2

i = 0LENGTH = 3

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 34: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 0LIST[1] = 1LIST[2] = 2

i = 0LENGTH = 3(0 < 2) = YES

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 35: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 0LIST[1] = 1LIST[2] = 2

i = 0LENGTH = 3(0 > 1) = NO

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 36: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 0LIST[1] = 1LIST[2] = 2

i = 1LENGTH = 3

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 37: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 0LIST[1] = 1LIST[2] = 2

i = 1LENGTH = 3(1 < 2) = YES

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 38: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 0LIST[1] = 1LIST[2] = 2

i = 1LENGTH = 3(1 > 2) = NO

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 39: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 0LIST[1] = 1LIST[2] = 2

i = 2LENGTH = 3

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 40: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 0LIST[1] = 1LIST[2] = 2

i = 2LENGTH = 3(2 < 2) = NO

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 41: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeLIST[0] = 0LIST[1] = 1LIST[2] = 2

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 42: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeFunction Sort(Arr){

LENGTH = Length(Arr)For (i = 0; i < LENGTH - 1; i++){

If (Arr[i] > Arr[i + 1]){

TEMP = Arr[i]Arr[i] = Arr[i + 1]Arr[i + 1] = TEMPi = -1

}}Return Arr;

}

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 43: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeFunction Sort(Arr){

LENGTH = Length(Arr)For (i = 0; i < LENGTH - 1; i++){

If (Arr[i] > Arr[i + 1]){

TEMP = Arr[i]Arr[i] = Arr[i + 1]Arr[i + 1] = TEMPi = -1

}}Return Arr;

}

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 44: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Function Sort(Arr){

LENGTH = Length(Arr)For (i = 0; i < LENGTH - 1; i++){

If (Arr[i] > Arr[i + 1]){

TEMP = Arr[i]Arr[i] = Arr[i + 1]Arr[i + 1] = TEMPi = -1

}}Return Arr;

}

Pseudo CodeFunction: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 45: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Function Sort(Arr){

LENGTH = Length(Arr)For (i = 0; i < LENGTH - 1; i++){

If (Arr[i] > Arr[i + 1]){

TEMP = Arr[i]Arr[i] = Arr[i + 1]Arr[i + 1] = TEMPi = -1

}}Return Arr;

}

Pseudo CodeFunction: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 46: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Function Sort(Arr){

LENGTH = Length(Arr)For (i = 0; i < LENGTH - 1; i++){

If (Arr[i] > Arr[i + 1]){

TEMP = Arr[i]Arr[i] = Arr[i + 1]Arr[i + 1] = TEMPi = -1

}}Return Arr;

}

Pseudo CodeFunction: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 47: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Function Sort(Arr){

LENGTH = Length(Arr)For (i = 0; i < LENGTH - 1; i++){

If (Arr[i] > Arr[i + 1]){

TEMP = Arr[i]Arr[i] = Arr[i + 1]Arr[i + 1] = TEMPi = -1

}}Return Arr;

}

Pseudo CodeFunction: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 48: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Function Sort(Arr){

LENGTH = Length(Arr)For (i = 0; i < LENGTH - 1; i++){

If (Arr[i] > Arr[i + 1]){

TEMP = Arr[i]Arr[i] = Arr[i + 1]Arr[i + 1] = TEMPi = -1

}}Return Arr;

}

Pseudo CodeFunction: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 49: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Function Sort(Arr){

LENGTH = Length(Arr)For (i = 0; i < LENGTH - 1; i++){

If (Arr[i] > Arr[i + 1]){

TEMP = Arr[i]Arr[i] = Arr[i + 1]Arr[i + 1] = TEMPi = -1

}}Return Arr;

}

Pseudo CodeFunction: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 50: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Function Sort(Arr){

LENGTH = Length(Arr)For (i = 0; i < LENGTH - 1; i++){

If (Arr[i] > Arr[i + 1]){

TEMP = Arr[i]Arr[i] = Arr[i + 1]Arr[i + 1] = TEMPi = -1

}}Return Arr;

}

Pseudo CodeFunction: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 51: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

Introduction to Computer Programming

WiBit.NetCopyright © BlueSignet LLC. All rights reserved.

Pseudo CodeFunction Sort(Arr){

LENGTH = Length(Arr)For (i = 0; i < LENGTH - 1; i++){

If (Arr[i] > Arr[i + 1]){

TEMP = Arr[i]Arr[i] = Arr[i + 1]Arr[i + 1] = TEMPi = -1

}}Return Arr;

}

Function: Sort

Required Parameters:

Arr (Input Array)

i = 0

LENGTH = Length of Arr

i < LENGTH - 1

Arr[i] > Arr[i+1]

Yes

TEMP = Arr[i]

Arr[i] = Arr[i+1]

Arr[i+1] = TEMP

i = -1

Yes

i = i+ 1

No

Retun ArrNo

Page 52: Pseudo Code - manalhelal.com · What is Pseudo Code High level and informal set of instructions used to describe an algorithm NOT a programming language Used to plan programs (Usually

The End?