Computational thinking: searching, sorting, ADTs and recursion – A Level Computer Science (9618)
41 questions · page 3 of 3
Question text
12 (a) Describe what is meant by recursion.
…
…
…
… [2]
(b) A Fibonacci sequence is a series of numbers formed by adding together the two preceding
numbers, for example:
0, 1, 1, 2, …
This function calculates and returns values in the Fibonacci sequence and uses recursion.
FUNCTION Fib(Number : INTEGER) RETURNS INTEGER
IF Number <= 1 THEN
Result ← Number
ELSE
Result ← Fib(Number – 1) + Fib(Number – 2)
ENDIF
RETURN Result
ENDFUNCTION
Complete the trace table for the function when it is called as Fib(5).
Call number
Function call
Number
Result
Return value
5
[5]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Question text
11
(a) The pseudocode shown represents a queue Abstract Data Type (ADT) with procedures for
initialisation and to add new items. It is incomplete.
CONSTANT MaxLength = 50
DECLARE FrontPointer : INTEGER
DECLARE RearPointer : INTEGER
DECLARE Length : INTEGER
DECLARE Queue : ARRAY[0 : MaxLength – 1] OF STRING
// initialisation of queue
PROCEDURE Initialise
‑1
FrontPointer
…
…
0
ENDPROCEDURE
// adding a new item to the queue
PROCEDURE Enqueue(NewItem : STRING)
IF … THEN
…
RearPointer
IF RearPointer > MaxLength – 1 THEN
0
RearPointer
ENDIF
…
Length + 1
Length
ENDIF
ENDPROCEDURE
(i)
Study the pseudocode and insert the identifiers to complete this table.
Identifier
Data type
Description
STRING
An array to store the contents of the queue.
INTEGER
Points to the last item of the queue.
INTEGER
Indicates the number of items in the queue.
INTEGER
Points to the first item of the queue.
[2]
(ii)
Complete the given pseudocode.
[5]
(b) Explain the reasons why a queue ADT works better than a stack ADT in organising print jobs.
…
…
…
…
…
… [3]
Permission to reproduce items where third‑party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer‑related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Question text
12 (a) The array Names[0:99] is in alphabetical order.
Complete this pseudocode binary search algorithm.
← 0
Lower
…
←
Mid
0
←
Exit
FALSE
OUTPUT "Enter the name to be found "
INPUT Target
REPEAT
… THEN
OUTPUT Target, " does not exist"
←
Exit
TRUE
ENDIF
←
Mid
Lower + (Upper – Lower + 1) DIV 2
IF Names[Mid] < Target THEN
←
…
Lower
ENDIF
IF Names[Mid] > Target THEN
…
ENDIF
… THEN
OUTPUT Target, " was found at location ", Mid
←
Exit
TRUE
ENDIF
…
[6]
(b) Big O notation is used to classify efficiency of algorithms.
The Big O notation for time complexity in a binary search is O(log n).
(i)
State the Big O notation for time complexity of a linear search.
… [1]
(ii)
Describe the meaning of O(log n) as it applies to a binary search algorithm.
…
…
…
… [2]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Question text
11
A simplified linked list is used to store the names of flowers in alphabetical order. It is implemented
using two 1D arrays:
•
Flower stores the names of the flowers.
•
NextPointer stores the pointer to the next flower name in the list.
HeadPointer indicates the index of the first flower name in the linked list.
HeadPointer
6
When the end of the linked list is reached, the next pointer has the value of 0.
The following table shows the initial content of the arrays.
Index
Flower
NextPointer
1
Rose
7
2
Marigold
1
3
Foxglove
10
4
Iris
9
5
Daisy
3
6
Dahlia
5
7
Saxifrage
0
8
Lupin
2
9
Lily
8
10
Hydrangea
4
(a) Several flower names have been deleted from the linked list. These are crossed out in the
following table.
Complete the table to show the new values of HeadPointer and NextPointer to keep the
remaining flower names in alphabetical order.
HeadPointer
Index
Flower
NextPointer
1
Rose
2
Marigold
3
Foxglove
4
Iris
5
Daisy
6
Dahlia
7
Saxifrage
8
Lupin
9
Lily
10
Hydrangea
[3]
(b) Complete the pseudocode algorithm so that it achieves the following when applied to the
arrays:
•
The flower name is input.
•
The linked list is searched, in order, for the flower name.
•
If the flower name is found, an appropriate message is output to indicate it has been
found.
•
If the flower name is not found, an appropriate message is output to indicate it has not
been found.
•
The algorithm terminates when the next pointer value is 0.
HeadPointer
Pointer
0
Found
OUTPUT "Enter a flower name "
… .
… .
IF Flower[Pointer] = FlowerName THEN
Pointer
Found
0
Pointer
ELSE
… .
ENDIF
ENDWHILE
… .
OUTPUT Flower[Found], " is found"
ELSE
… .
ENDIF
[5]
(c) Explain how you could improve the simplified linked list structure.
…
…
…
… [2]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet. This is produced for each series of examinations and is freely available to download
at www.cambridgeinternational.org after the live examination series.
Cambridge Assessment International Education is part of Cambridge Assessment. Cambridge Assessment is the brand name of the University of Cambridge
Question text
3
A binary tree consists of nodes. Each node has 3 integer values: a left pointer, data and a right
pointer.
The binary tree is stored using a global 2D array.
The pseudocode declaration for the array is:
DECLARE ArrayNodes : ARRAY[0:19, 0:2] OF INTEGER
For example:
•
ArrayNodes[0, 0] stores the left pointer for the first node.
•
ArrayNodes[0, 1] stores the data for the first node.
•
ArrayNodes[0, 2] stores the right pointer for the first node.
–1 indicates a null pointer, or null data.
(a) Write program code to:
•
declare the global 2D array ArrayNodes
•
initialise all 3 integer values to –1 for each node.
Save your program as Question3_N22.
Copy and paste the program code into part 3(a) in the evidence document.
[3]
(b) The binary tree stores the following values:
Index
Left pointer
Data
Right pointer
0
1
20
5
1
2
15
–1
2
–1
3
3
3
–1
9
4
4
–1
10
–1
5
–1
58
–1
6
–1
–1
–1
FreeNode stores the index of the first free element in the array, initialised to 6.
RootPointer stores the index of the first node in the tree, initialised to 0.
Amend your program by writing program code to store the given data in ArrayNodes and
initialise the free node and root node pointers.
Save your program.
Copy and paste the program code into part 3(b) in the evidence document.
[2]
(c) The following recursive pseudocode function searches the binary tree for a given value. If the
value is found, the function must return the index of the value. If the value is not found, the
function must return –1.
The function is incomplete. There are four incomplete statements.
FUNCTION SearchValue(Root : INTEGER,
ValueToFind : INTEGER) RETURNS INTEGER
IF Root = –1 THEN
RETURN –1
ELSE
IF ArrayNodes[Root, 1] = ValueToFind THEN
RETURN …
ELSE
IF ArrayNodes[Root, 1] = –1 THEN
RETURN –1
ENDIF
ENDIF
ENDIF
IF ArrayNodes[Root, 1] … ValueToFind THEN
RETURN SearchValue(ArrayNodes[ … , 0], ValueToFind)
ENDIF
IF ArrayNodes[Root, … ] < ValueToFind THEN
RETURN SearchValue(ArrayNodes[Root, 2], ValueToFind)
ENDIF
ENDFUNCTION
Write program code for the function SearchValue().
Save your program.
Copy and paste the program code into part 3(c) in the evidence document.
[5]
(d) A post order traversal performs the following operation:
•
visit the left node
•
visit the right node
•
output the root.
For example, in the following tree, the output would be: 3
9
25
60
50
50
25
60
3
9
An outline of the PostOrder() procedure is:
•
If left node is not empty, make a recursive call with the left node as the root.
•
If right node is not empty, make a recursive call with the right node as the root.
•
Output the current root node.
The procedure PostOrder() takes the root node as a parameter.
Write program code for the procedure PostOrder().
Save your program.
Copy and paste the program code into part 3(d) in the evidence document.
[7]
(e) (i)
Amend the main program by writing program code to:
•
call the function SearchValue() to find the position of the number 15 in the tree
•
use the result from SearchValue() to output either the index of the value if found,
or an appropriate message to state that the value was not found
•
call the procedure PostOrder().
Save your program.
Copy and paste the program code into part 3(e)(i) in the evidence document.
[3]
(ii)
Test your program.
Take a screenshot to show the output.
Copy and paste the screenshot into part 3(e)(ii) in the evidence document.
[1]
Permission to reproduce items where third-party owned material protected by copyright is included has been sought and cleared where possible. Every
publisher will be pleased to make amends at the earliest possible opportunity.
To avoid the issue of disclosure of answer-related information to candidates, all copyright acknowledgements are reproduced online in the Cambridge
Assessment International Education Copyright Acknowledgements Booklet.
Question text
8
A binary search or a linear search can be used to look for a specific value in an array.
(a) Complete this pseudocode algorithm for a linear search.
DECLARE
MyList : ARRAY[0:9] OF INTEGER
DECLARE
MaxIndex : INTEGER
DECLARE
Index : INTEGER
DECLARE
Found : BOOLEAN
ValueToFind : …
DECLARE
INPUT ValueToFind
←
FALSE
Found
←
0
Index
←
…
MaxIndex
REPEAT
IF MyList[Index] = ValueToFind THEN
←
TRUE
Found
ENDIF
←
…
Index
UNTIL Found OR Index > MaxIndex
IF Found THEN
OUTPUT "Value found at position ", Index
ELSE
OUTPUT …
ENDIF
[4]
(b) (i)
State the necessary condition for a binary search.
…
… [1]
(ii)
Describe how to perform a binary search.
…
…
…
…
…
…
…
… [4]
(iii)
Explain how the performance of a binary search varies according to the number of values
in the array.
…
…
… [1]
(c) Compare the performance of the algorithms for a binary search and a linear search using
Big O notation for order of time complexity.
…
…
…
…
…
…
Question text
2
A 2D array stores data entered by a user.
(a) The main program declares a 2D array of 10 by 10 integer elements.
The array is initialised with a random number between 1 and 100 in each element.
Write program code for the main program.
Save your program as Question2_J22.
Copy and paste the program code into part 2(a) in the evidence document.
[4]
(b) The following bubble sort pseudocode algorithm sorts the data in the first dimension of the 2D
array into ascending numerical order.
10
ArrayLength
0 TO ArrayLength - 1
FOR X
0 TO ArrayLength - 2
FOR Y
0 TO ArrayLength - Y - 2
FOR Z
IF ArrayData[X, Z] > ArrayData[X, Z + 1] THEN
ArrayData[X, Z]
TempValue
ArrayData[X, Z+1]
ArrayData[X, Z]
TempValue
ArrayData[X, Z + 1]
ENDIF
NEXT Z
NEXT Y
NEXT X
(i)
Amend your main program by writing program code to implement the bubble sort
algorithm after the initialisation of the array elements.
You must not use any built-in sorting functions for your programming language.
Save your program.
Copy and paste the program code into part 2(b)(i) in the evidence document.
[5]
(ii)
Write program code for a procedure to output all the values in the 2D array. The values
should be output as a 2D grid, with values in rows and columns.
Call the procedure before and after your bubble sort code.
Save your program.
Copy and paste the program code into part 2(b)(ii) in the evidence document.
[3]
(iii)
Test your program.
Take a screenshot to show the output.
Copy and paste the screenshot into part 2(b)(iii) in the evidence document.
[1]
(c) The following pseudocode function uses recursion to perform a binary search in the first row
of the array, for the value SearchValue in the array SearchArray.
The function returns −1 if the item was not found, or it returns the index where it is found.
There are six incomplete statements.
FUNCTION BinarySearch(SearchArray, Lower, Upper, SearchValue)RETURNS
INTEGER
IF Upper >= Lower THEN
(Lower + (Upper – 1)) DIV …
Mid
IF SearchArray[0, Mid] = … THEN
RETURN …
ELSE
IF SearchArray[0, Mid] > SearchValue THEN
RETURN BinarySearch(SearchArray, … , Mid – 1,
SearchValue)
ELSE
RETURN BinarySearch(SearchArray, Mid + 1, … ,
SearchValue)
ENDIF
ENDIF
ENDIF
RETURN …
ENDFUNCTION
Note: the arithmetic operator DIV performs integer division, e.g. the result of 10 DIV 3 will be 3.
(i)
Write program code for the recursive function BinarySearch().
Save your program.
Copy and paste the program code into part 2(c)(i) in the evidence document.
[8]
(ii)
In the main program, test the function BinarySearch() twice, outputting the returned
value each time.
One test should be for a number that is in the first line of the array.
One test should be for a number that is not in the first line of the array.
Take a screenshot to show the output.
Copy and paste the screenshot into part 2(c)(ii) in the evidence document.
[2]
Question text
10 (a) State three essential features of recursion.
1 …
…
2 …
…
3 …
…
[3]
(b) Explain the reasons why a stack is a suitable Abstract Data Type (ADT) to implement
recursion.
…
…
…
…
…
… [3]
(c) Identify two ADTs other than a stack.
1 …
2 …
[2]
(d) The function StackFull() checks whether a stack is full.
The function uses the variable TopOfStack to represent the pointer to the most recent
position used on the stack, and the variable Max to represent the maximum size of the stack.
Assume TopOfStack and Max are global variables.
FUNCTION StackFull() RETURNS BOOLEAN
IF TopOfStack = Max THEN
RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ENDFUNCTION
An algorithm AddInteger is required to add a new integer data element to a stack.
The stack is implemented as an array ArrayStack.
The function AddInteger() calls StackFull() and returns an appropriate message.
Complete the pseudocode for the function AddInteger().
FUNCTION AddInteger(NewInteger : INTEGER) RETURNS STRING
…
…
…
…
…
…
…
Question text
3
An ordered binary tree stores integer data in ascending numerical order.
The data for the binary tree is stored in a 2D array with the following structure:
LeftPointer
Data
RightPointer
Index
[0]
[1]
[2]
[0]
1
10
2
[1]
-1
5
-1
[2]
-1
16
-1
Each row in the table represents one node on the tree.
The number -1 represents a null pointer.
(a) The 2D array, ArrayNodes, is declared with space for 20 nodes.
Each node has a left pointer, data and right pointer.
The program also initialises the:
•
RootPointer to -1 (null); this points to the first node in the binary tree
•
FreeNode to 0; this points to the first empty node in the array.
Write program code to declare ArrayNodes, RootPointer and FreeNode in the main
program.
If you are writing in Python programming language, include attribute declarations using
comments.
Save your program as question 3.
Copy and paste the program code into part 3(a) in the evidence document.
[4]
(b) The procedure AddNode() adds a new node to the array ArrayNodes.
The procedure needs to:
•
take the array, root pointer and free node pointer as parameters
•
ask the user to enter the data and read this in
•
add the node to the root pointer if the tree is empty
•
otherwise, follow the pointers to find the position for the data item to be added
•
store the data in the location and update all pointers.
There are six incomplete statements in the following pseudocode for the procedure AddNode().
PROCEDURE AddNode(BYREF ArrayNodes[] : ARRAY OF INTEGER,
BYREF RootPointer : INTEGER, BYREF FreeNode : INTEGER)
OUTPUT "Enter the data"
INPUT NodeData
IF FreeNode <= 19 THEN
←
-1
ArrayNodes[FreeNode, 0]
←
…
ArrayNodes[FreeNode, 1]
←
-1
ArrayNodes[FreeNode, 2]
IF RootPointer = … THEN
←
0
RootPointer
ELSE
←
FALSE
Placed
←
RootPointer
CurrentNode
WHILE Placed = FALSE
IF NodeData < ArrayNodes[CurrentNode, 1] THEN
IF ArrayNodes[CurrentNode, 0] = -1 THEN
←
…
ArrayNodes[CurrentNode, 0]
←
TRUE
Placed
ELSE
←
ArrayNodes[CurrentNode, 0]
…
ENDIF
ELSE
IF ArrayNodes[CurrentNode, 2] = -1 THEN
←
FreeNode
ArrayNodes[CurrentNode, 2]
←
…
Placed
ELSE
←
ArrayNodes[CurrentNode, 2]
CurrentNode
ENDIF
ENDIF
ENDWHILE
ENDIF
←
… + 1
FreeNode
ELSE
OUTPUT("Tree is full")
ENDIF
ENDPROCEDURE
Write program code for the procedure AddNode().
Save your program.
Copy and paste the program code into part 3(b) in the evidence document.
[8]
(c) The procedure PrintAll() outputs the data in each element in ArrayNodes, in the order
they are stored in the array.
Each element is printed in a row in the order:
LeftPointer
Data
RightPointer
For example:
1
20
-1
-1
10
-1
Write program code for the procedure PrintAll().
Save your program.
Copy and paste the program code into part 3(c) in the evidence document.
[4]
(d) The main program should loop 10 times, each time calling the procedure AddNode(). It
should then call the procedure PrintAll().
(i)
Edit the main program to perform the actions described.
Save your program.
Copy and paste the program code into part 3(d)(i) in the evidence document.
[3]
(ii)
Test the program by entering the data:
10
5
15
8
12
6
20
11
9
4
Take a screenshot to show the output after the given data are entered.
Copy and paste the screenshot into part 3(d)(ii) in the evidence document.
[1]
(e) An in-order tree traversal visits the left node, then the root (and outputs this), then visits the
right node.
(i)
Write a recursive procedure, InOrder(), to perform an in-order traversal on the tree
held in ArrayNodes.
Save your program.
Copy and paste the program code into part 3(e)(i) in the evidence document.
[7]
(ii)
Test the procedure InOrder() with the same data entered in part (d)(ii).
Take a screenshot to show the output after entering the data.
Copy and paste the screenshot into part 3(e)(ii) in the evidence document.
[1]
Permission to reproduce items where third-party owned materia
Question text
3
An ordered binary tree stores integer data in ascending numerical order.
The data for the binary tree is stored in a 2D array with the following structure:
LeftPointer
Data
RightPointer
Index
[0]
[1]
[2]
[0]
1
10
2
[1]
-1
5
-1
[2]
-1
16
-1
Each row in the table represents one node on the tree.
The number -1 represents a null pointer.
(a) The 2D array, ArrayNodes, is declared with space for 20 nodes.
Each node has a left pointer, data and right pointer.
The program also initialises the:
•
RootPointer to -1 (null); this points to the first node in the binary tree
•
FreeNode to 0; this points to the first empty node in the array.
Write program code to declare ArrayNodes, RootPointer and FreeNode in the main
program.
If you are writing in Python programming language, include attribute declarations using
comments.
Save your program as question 3.
Copy and paste the program code into part 3(a) in the evidence document.
[4]
(b) The procedure AddNode() adds a new node to the array ArrayNodes.
The procedure needs to:
•
take the array, root pointer and free node pointer as parameters
•
ask the user to enter the data and read this in
•
add the node to the root pointer if the tree is empty
•
otherwise, follow the pointers to find the position for the data item to be added
•
store the data in the location and update all pointers.
There are six incomplete statements in the following pseudocode for the procedure AddNode().
PROCEDURE AddNode(BYREF ArrayNodes[] : ARRAY OF INTEGER,
BYREF RootPointer : INTEGER, BYREF FreeNode : INTEGER)
OUTPUT "Enter the data"
INPUT NodeData
IF FreeNode <= 19 THEN
←
-1
ArrayNodes[FreeNode, 0]
←
…
ArrayNodes[FreeNode, 1]
←
-1
ArrayNodes[FreeNode, 2]
IF RootPointer = … THEN
←
0
RootPointer
ELSE
←
FALSE
Placed
←
RootPointer
CurrentNode
WHILE Placed = FALSE
IF NodeData < ArrayNodes[CurrentNode, 1] THEN
IF ArrayNodes[CurrentNode, 0] = -1 THEN
←
…
ArrayNodes[CurrentNode, 0]
←
TRUE
Placed
ELSE
←
ArrayNodes[CurrentNode, 0]
…
ENDIF
ELSE
IF ArrayNodes[CurrentNode, 2] = -1 THEN
←
FreeNode
ArrayNodes[CurrentNode, 2]
←
…
Placed
ELSE
←
ArrayNodes[CurrentNode, 2]
CurrentNode
ENDIF
ENDIF
ENDWHILE
ENDIF
←
… + 1
FreeNode
ELSE
OUTPUT "Tree is full"
ENDIF
ENDPROCEDURE
Write program code for the procedure AddNode().
Save your program.
Copy and paste the program code into part 3(b) in the evidence document.
[8]
(c) The procedure PrintAll() outputs the data in each element in ArrayNodes, in the order
they are stored in the array.
Each element is printed in a row in the order:
LeftPointer
Data
RightPointer
For example:
1
20
-1
-1
10
-1
Write program code for the procedure PrintAll().
Save your program.
Copy and paste the program code into part 3(c) in the evidence document.
[4]
(d) The main program should loop 10 times, each time calling the procedure AddNode(). It
should then call the procedure PrintAll().
(i)
Edit the main program to perform the actions described.
Save your program.
Copy and paste the program code into part 3(d)(i) in the evidence document.
[3]
(ii)
Test the program by entering the data:
10
5
15
8
12
6
20
11
9
4
Take a screenshot to show the output after the given data are entered.
Copy and paste the screenshot into part 3(d)(ii) in the evidence document.
[1]
(e) An in-order tree traversal visits the left node, then the root (and outputs this), then visits the
right node.
(i)
Write a recursive procedure, InOrder(), to perform an in-order traversal on the tree
held in ArrayNodes.
Save your program.
Copy and paste the program code into part 3(e)(i) in the evidence document.
[7]
(ii)
Test the procedure InOrder() with the same data entered in part (d)(ii).
Take a screenshot to show the output after entering the data.
Copy and paste the screenshot into part 3(e)(ii) in the evidence document.
[1]
Permission to reproduce items where third-party owned material
Question text
8
(a) State two factors that may affect the performance of a sorting algorithm.
…
…
…
… [2]
(b) The given algorithm is a simple bubble sort that arranges a set of scores stored in a one-
dimensional array into descending order, and orders the corresponding students’ names
stored into a two-dimensional array in the same order as the scores. All the arrays are indexed
from 1.
The contents of both arrays after sorting are shown.
Name
Score
1
2
1
1
98
Smithfield
Tom
2
2
97
Johnson
Jane
…
…
248 5
248 Peters
Jade
249 3
249 Allen
John
←
249
YearSize
←
TRUE
Flag
WHILE Flag = TRUE
←
FALSE
Flag
←
1 TO YearSize - 1
FOR Student
IF Score[Student] < Score[Student + 1] THEN
←
Score[Student]
Temp1
←
Name[Student,1]
Temp2
←
Name[Student,2]
Temp3
←
Score[Student + 1]
Score[Student]
←
Name[Student + 1,1]
Name[Student,1]
←
Name[Student + 1,2]
Name[Student,2]
←
Temp1
Score[Student + 1]
←
Temp2
Name[Student + 1,1]
←
Temp3
Name[Student + 1,2]
←
TRUE
Flag
ENDIF
NEXT Student
ENDWHILE
Write an algorithm, using pseudocode, that will perform the same task using an insertion sort.
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…
…