How do you make a program loop a set number of times?
for i = 0 to 4 #contents next i or for i = 0 to len(list) #contents next i
What do you do at the top of a pseudo code program?
Define all the variable data types e.g. maxNum is integer Mean is real name is string check is boolean
How do you define an if statement?
if #code such as list(i) > MaxNum:
#task
endif
How do you define a while statement?
while
end while
What is better merge sort or bubble sort?
Merge sort as it is more efficient.
What is the pseudo code for bubble sorts?
Declare BubbleSort(bubbleList):
exchanges = True
passnum = len(bubbleList)-1
while passnum > 0 and exchanges = True
exchanges = False
for i = 1 to n
if bubbleList[i]>bubbleList[i+1]:
exchanges = True
temp = bubbleList[i]
bubbleList[i] = bubbleList[i+1]
bubbleList[i+1] = temp
end if
next i
passnum = passnum-1
end while
end SubroutinebubbleList=[20,30,40,90,50,60,70,80,100,110]
BubbleSort(bubbleList)
print(bubbleList)