Hi.. So I jus started using scratch and I'm still not so familiar with it. I wonder if anyone can give me any hints on how to do this project
1) create a list and variables LENGTH,MINVAL,MAXVAL.
and assign a positive integer value to the variable lenght and intger values to maxval and minval. The variable lenght is taken as the total items in the list. Assign a value to each item in the list so it is a random number between minval and maxval
2)
Make a procedure called bubble that sorts items in the list in an increasing order using the bubble sort algorithm
3) make a procedure called selection that sorts items in the list using the selection sort algorithm in increasing order
This is what I have to do and I'm totally lost.. So any help would be appreciated
Thanks
Offline
That sounds a lot like a homework project...
Rather than just give you the answer (which wouldn't help you learn very much), can you tell us what part you are stuck on and maybe we can help you with that? For example, have you downloaded the Scratch program so you can progam in it? Do you know how to make variables and lists? Where are you in the process?
Offline
Why do teachers allways make things difficult? I have no clue why you would use words like "procedure", "integer value", ...? I'd start translating it to normal scratch language:
1) create a list and variables LENGTH, MINVAL,MAXVAL.minval and maxval are numbers. Assign a value to each item in the list so it is a random number between minval and maxval
2) Make a script started with a broadcast "bubble" that sorts items in the list in an increasing order using the bubble sort algorithm
3) Make a script started with a broadcast "bubble" that sorts items in the list using the selection sort algorithm in increasing order
I'm not telling you the solution (have my own homework you know ) but I have some tips. Random numbers can be done with the "pick random () to ()". Thats where you'll need your minval and maxval probably, and also the length variable!
The two sort algorithms, two options:
- You already know them and just start programming
or...
- www.google.com or just the scratch website. Tip: list sorting has been done already, nice search feature at the top of the page (go to home then search, not a forum search)
Offline
Hey I have downloaded scratch an I managed to make a list of random value with the minval and maxval set to a certain value... The first part
I'm basically stuck on how to make the program for sorting
Like for bubble I know wat the bubble sort algorithm is and how values continue to being swapped from top to bottom till all value in increasing order
I'm jus not sure how to make it on scratch. Like how to set swap index 1 with index two if value is lower and so on and then repeat.
Same wit slection not sure how to set the swapping part
Thanks
Offline
You know, the website is full of open source projects for many things. If you wanted to see a project for bubble sort you could just enter bubble sort into the website's search bar.
http://scratch.mit.edu/projects/Jens/257519
That is the first result for "bubble sort"
Offline
i think so, but not online. Its gonna be a lot of work however. Your gonna need to have non reseted variables, and save constantly. Also scratch has no way to get the date.
Offline
yambanshee wrote:
i think so, but not online. Its gonna be a lot of work however. Your gonna need to have non reseted variables, and save constantly. Also scratch has no way to get the date.
I did write a Python/Scratch pair of programs that used the Scratch sockets to get the system time and date from the Python piece...so Scratch does have a way to get the date...it's just really awkward
Offline
cmon wrote:
what are 'selections' ,'iteration' and 'sequences'?
I am doing this for homework and I am not sure what they are.
Please help me!
You might get a better response if you start your own topic by using the "Post new topic" link at the top right section of the forum main page. Probably the Miscellaneous forum would be your best bet. I can't really figure out what you're asking for without some kind of context. What subject are you discussing?
Offline