Our site uses cookies. Some of the cookies we use are essential for parts of the site to operate and have already been set. You may delete and block all cookies from this site, but parts of the site will not work. To find out more about cookies on this website, see our Cookie Policy
Accept
© eRevision.uk and ZigZag Education 2024
This test is run by guest.
Note that your final mark will not be saved in the system.

Fundamentals of Algorithms GapFill

Target Level
4-5
Running Total
0
0%
Attempt
1 of 3

You must fill all the gaps before clicking ‘Check Answers!’

An algorithm is  a series of steps that is used to solve a problema computer program that uses subroutinesa graphical representation of the steps that need to be followed to solve a problema computer program that is used to solve a problem. Two key terms are used to define algorithms;  flowchartscomponentsdividingdecomposition is the process of breaking down a problem into identifiable tasks and abstraction is a way to  organise the computer to solve the problemuse flowcharts to show how to solve the problemhide unnecessary details and focus on the important elementscreate the correct number of subroutines to solve the problem to solve the problem.

There are many different types of algorithm, including searching and sorting algorithms. The following is an implementation of a linear search algorithm:

numbers ← [4,8,7,1,2]
found ←  TRUE112FALSE
toFind ←  outputASCstrUSERINPUT
index ← 0
WHILE found = False AND index  >===<=< LEN(numbers)
IF numbers[index]=toFind THEN
found ← True
PRINT('That number is in the list')
ELSE
index ←  index +1numbers[index]index[numbers]toFind=numbers[index]
ENDIF
ENDWHILE
IF found=False THEN
PRINT('That number is not in the list')
ENDIF

The linear search algorithm checks every element in a list in the order that they appear until the element that is being searched for is found, or it reaches the end of the list. If the list is twice as long, searching using this technique will, on average, require twice as much time. To speed up searching, the  quickbinarybucketmerge search algorithm can be used instead. This algorithm checks the  secondlowestmiddlefirst element of the list, and if the element being checked is not the same element that is being searched for, that element is discarded along with every element that comes before or after it in the list (depending on whether the element being checked is lower or higher than the element being searched for). This type of search can be significantly faster than a linear search, but can only be used if the list  has an odd number of elementsis shortis sortedis unsorted.

Sorting algorithms can be used to rearrange the order of elements in a list. There are a number of sorting algorithms which include the  quickbucketbinarymerge sort splits the list into single elements and combines them into larger and larger sorted lists; and the  bubbleinsertionbinarymerge sort, which goes along the list to check every pair of elements and swaps elements that are in the wrong order.  For  numericallargetextsmall sets of data the merge sort is much more efficient than the bubble sort.

This is your 1st attempt! You get 3 marks for each one you get right. Good luck!

Pass Mark
72%