Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "while a <> b" mean in pseudocode?

Tags:

pseudocode

In an assignment we are to use a specific algorithm to find the greatest common divisor in assembly, written in assembly.

The algorithm is as follows:

Input:a,b
Local: c
 While a <> b
     While a > b
         c = a - b
         a = c
     End While
     While b > a
         c = b - a
         b = c
     End While
End While
At this point, GCD(a,b)=a=b.  

What does a <> b mean in the third line?

like image 484
Justin Avatar asked Mar 14 '11 02:03

Justin


People also ask

What does != Mean in pseudocode?

!= means "is not equal to". A minus before a variable means 0 minus that variable. For example, -a means (0 - a) . The << operator in the pseudocode is a bitwise left shift, with both sides of the operator being integers.

What keywords are commonly used in pseudocode?

Words such as set, reset, increment, compute, calculate, add, sum, multiply, ... print, display, input, output, edit, test , etc. with careful indentation tend to foster desirable pseudocode.

How do you write a loop in pseudocode?

Using For Loops Say we wanted to loop through a block of code 5 times, we use i, a local variable, that is built into most programming languages, and can be used in pseudocode too. We would say: For i = 1 To 5; 5 being the number of times you want to loop the code; you can change this to what you would like.

What does the arrow mean in pseudo code?

Assigning a value to a variable is indicated in pseudocode using an arrow symbol (←). The arrow points from the value being assigned towards the variable it is being assigned to.


1 Answers

In certain old languages, the <> operator meant "not equal" (you can see it as "less than or greater than"). The convention != has largely taken over nowadays.

like image 158
luqui Avatar answered Jan 04 '23 11:01

luqui