Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please see screenshot attached. The value of comparison count is not 4 5 I dont know where is mistake. Please I am expecting to write
Please see screenshot attached. The value of comparison count is not I dont know where is mistake. Please I am expecting to write the whole script so that whengreenflagclicked is run, the value of comparisoncount is This is OU BUILD. OUBuild
File
Edit
TMQ
comparisoncount
position
otherposition
show list computerclub
Task: In this part you will investigate how many comparisons between list items exchange sort requires to sort some lists of different lengths.
iTo count the comparisons, we have provided a variable comparisoncount.
The only place where list items are compared is in the whengreenflagclicked script. Add a block to this script at an appropriate point to increment comparisoncount each time two list items are compared.
We are not quite done, because comparisoncount needs to be initialised to at the start of the whengreenflagclicked script, before we start the sort. Add a block to initialise comparisoncount at an appropriate point in the script.
Then make sure the watcher for comparisoncount is visible on the stage, and run the whengreenflagclicked script.
You should find that once the script has run the value of comparisoncount is
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started