Bifalgorithm post
So let's make a sorting algorithm using scratch to remove duplicates and alphabetize their words. So the first thing I made was this base script to take in user input and store them in a list called multiset. Now we don't want any duplicates, so I made this new list called set. We'll iterate the multiset checking the word is already in set using index as the counter. If it's not, we'll add it, if it is, we'll move on to the next position. Dex will use the selection sort to alphabetize the words. Create an index, index of bestsofar and check here variable. These will check our position in the list. Create a loop to compare items and check here to items in index of bestsofar. the Save the current item in position 1 to a temporary variable. Afterwards, replace position 1 with the item of index of best. Then, place the original item into index of best. Now, enclose all of this code in a loop and increment index. This will process every item in the list.
So let's make a sorting algorithm using scratch to remove duplicates and alphabetize their words. So the first thing I made was this base script to take in use…
Ideas in this flowchart
- Sorting Algorithm in Scratch
- User Input Handling
- Store Input in Multiset
- Remove Duplicates
- Create Set List
- Iterate Multiset
- Check for Duplicates
- Add to Set
- Alphabetize Words
- Selection Sort
- Create Index Variables
- Compare Items
- Swap Items
- Enclose in Loop