barebones sort algorithm
Posted
by user309322
on Stack Overflow
See other posts from Stack Overflow
or by user309322
Published on 2010-04-16T15:06:03Z
Indexed on
2010/04/16
17:23 UTC
Read the original article
Hit count: 259
i have been asked to make a simple sort aglorithm to sort a random series of 6 numbers into numerical order. However i have been asked to do this using "Barebones" a theoretical language put forward in the Book Computer Science an overview.
Some information on the language can be found here http://www.brouhaha.com/~eric/software/barebones/
Just to clarify i am a student teacher and have been doing anaysis on "mini-programing languages" and their uses in a teaching environment, i suggested to my tutor that i look at barebones and asked what sort of exmaple program i should write . He suggested a simple sort algorithm. Now since looking at the language i cant understand how i can do this without using arrays and if statements.
The code to swap the value of variables would be
while a not 0 do;
incr Aux1;
decr a;
end;
while b not 0 do;
incr Aux2
decr b
end;
while Aux1 not 0 do;
incr a;
decr Aux1;
end;
while Aux2 not 0 do;
incr b;
decr Aux2;
end;
however the language does not provide < or > operators
© Stack Overflow or respective owner