Computational thinking and problem-solving
60 questions. Open a question to solve it and check the official answer.
Recursion · 3 marks · official answer ready
(b) A stack is used to implement recursion. State the three essential features of recursion. 1 ....................................................................................…
Recursion · 3 marks · official answer ready
(b) Explain the reasons why a stack is used when a recursive algorithm is executed. ...............................................................................................…
Recursion · 3 marks · official answer ready
11 Describe when the use of recursion would be beneficial and give an example. Description ........................................................................................…
Recursion · 6 marks · official answer ready
(e) The recursive function RecursiveBinarySearch() takes four parameters: • an integer array • the lower bound of the array • the upper bound of the array • the value to find in t…
Recursion · 6 marks · official answer ready
3 A program is written to perform different individual processes using arrays. (a) A 1D array stores 10 integers. (i) A recursive function RecursiveCount() takes three parameters:…
Recursion · 30 marks
(ii) Test your program. Take a screenshot of the output(s). Save your program. Copy and paste the screenshot(s) into part 2(f)(ii) in the evidence document. [1] 12 3 A program is …
Recursion · 2 marks · official answer ready
(b) Describe what is meant by recursion. ..........................................................................................................................................…
Recursion · 1 mark · official answer ready
(c) A binary tree is a suitable Abstract Data Type (ADT) that a designer can implement using recursive algorithms. Identify one other ADT that a designer can implement using recur…
Algorithms · 4 marks · official answer ready
10 Identify the two main protocols that form Transport Layer Security (TLS) and state the purpose of each. Protocol 1 .............................................................…
Recursion · 2 marks · official answer ready
(b) A binary tree can be used to implement recursion. Identify one feature of an algorithm that makes it beneficial to use recursion. Give one example of an application that could…
Algorithms · 1 mark
10 (a) State the purpose of the A* and Dijkstra’s algorithms. .....................................................................................................................…
Algorithms · 2 marks · official answer ready
(b) Outline the difference between the A* and Dijkstra’s algorithms. ..............................................................................................................…
Recursion · 100 marks · official answer ready
13 The recursive procedure Delete() is defined as follows: PROCEDURE Delete(Index, Target) IF Numbers[Index] > 0 THEN IF Numbers[Index] >= Target THEN Numbers[Index] Numbers[Index…
Recursion · 6 marks · official answer ready
(iii) The method Insert() takes a node as a parameter and then searches the tree to find the position to insert the new node by: • checking whether the node’s data is less than or…
Recursion · 5 marks · official answer ready
(d) The recursive procedure OutputInOrder() outputs the data stored in the binary tree in ascending numerical order. The procedure takes a Node object as a parameter and then: • c…
Recursion · 6 marks · official answer ready
(e) The function Search() performs a binary search to find ItemToFind in DataArray The function takes two parameters: • DataArray, an array of integers • ItemToFind, an integer to…
Recursion · 5 marks · official answer ready
(i) Write program code for RemoveData(). Save your program. Copy and paste the program code into part 3(d)(i) in the evidence document. [5]
Recursion · 5 marks · official answer ready
(i) Write program code for RemoveData(). Save your program. Copy and paste the program code into part 3(d)(i) in the evidence document. [5]
Recursion · 4 marks · official answer ready
(i) The following recursive pseudocode function sorts the array into ascending order using an insertion sort and returns the sorted array. DECLARE LastItem : INTEGER DECLARE Check…
Recursion · 2 marks · official answer ready
(ii) Amend the main program to: • call RecursiveInsertion()with the initialised array NumberArray and the number of elements as parameters • output the word ‘Recursive’ • output t…
