How to find the highest/biggest number in a list

437 views
Skip to first unread message

Enora Nedelec

unread,
Jul 20, 2015, 3:07:04 PM7/20/15
to mitappinv...@googlegroups.com

There could be a better way, but this one is working


Italo

unread,
Jul 20, 2015, 9:26:19 PM7/20/15
to mitappinv...@googlegroups.com
Thanks Enora. I used your idea to make a sorting procedure (I think it uses the same method as bubble sorting, right?)
Anyway, is fast until you try to sort a big list (more then 100). For projects that do not require too many numbers, it will be OK.

There's also an .aia to demonstrate how to use it and how fast/slow it is.

You just call the procedure with a list of numbers as a parameter and the letter "a" for Ascending order or a "d" for descending order. (actually, anything that's not an "a" will produce descending order).
And it returns the same list ordered.





number_list_sorting.aia

Scott Ferguson

unread,
Sep 28, 2015, 1:42:14 AM9/28/15
to MIT App Inventor Forum
Alternatively you can add more sockets to the max block then put the values there.
But your method would be good for using an existing list of values.
---
sf
Reply all
Reply to author
Forward
0 new messages