Consider the following recursive method, where N is a positive integer
mystery(N)
if (N > 0) AND (N mod 2 = 0) then
mystery(N−2)
end if
output N
end mystery
the output produced by the method call mystery(4)
Practice IB Computer Science (CS) Topic 5. Abstract Data Structures with authentic exam-style questions for both SL and HL students. This question bank focuses on the exact syllabus content for 5. Abstract Data Structures and mirrors Paper 1, 2, 3 style where relevant.
Get instant solutions, detailed explanations, and build confidence with questions aligned to IB examiner expectations.
Consider the following recursive method, where N is a positive integer
mystery(N)
if (N > 0) AND (N mod 2 = 0) then
mystery(N−2)
end if
output N
end mystery
the output produced by the method call mystery(4)
(e) an algorithm to determine the winning team, using the rule that a team's final time is the sum of the times of its three fastest participants (with non-finishers assigned 1000 minutes). any additional data structures you would use.
Determinism and non-invertibility are key characteristics of hashing.
how these properties contribute to the functionality and security of blockchain technology.
(a) two characteristics of a digital signature.
(b) two stages in the proof-of-work process.
A local charity organizes a half-marathon to raise money. The rules to participate in the half-marathon are as follows:
During registration, an array, PARTICIPANTS, with 450 positions is used to hold the abbreviated team names that are declared by each participant. Simultaneously, a collection TNAMES is generated: any new team name that is declared is added to the collection.
Part of the array PARTICIPANTS is shown below, where, for example, the first participant declared that they are part of team TK. The initial part of the collection TNAMES is also shown, with arrows indicating the direction of growth.
PARTICIPANTS:
| [0] | [1] | [2] | [3] | [4] | [5] | [6] | [7] | [8] | [9] | [10] | [11] | [12] | [13] | [14] |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TK | W | AC | TK | W | TK | AC | W | TK | TK | AC | QA | AC | W | QA |
TNAMES [Image of TNAMES collection]
Both PARTICIPANTS and TNAMES are used to construct the array, TEAM, that groups all participants who belong to the same team. Part of the array TEAM is shown below.
TEAM:
In TEAM, each element is related to one other index in the array, shown by the arrows on the above diagram. This relation will eventually form a closed path (for this example 0, 3, 5, 8, 9 and back to 0). The relation reflects the information in PARTICIPANTS, by grouping people who declared the same team name during registration. Hence, participants 0, 3, 5, 8 and 9 are on the same team and, from PARTICIPANTS, that team is TK.
(a) the minimum size of TNAMES to ensure the names of all potential teams can be stored.
(b) the position in PARTICIPANTS of the second participant that registered for team QA.
5.1 Abstract data structures (HL)
how the order in which items are inserted into a Binary Search Tree (BST) can impact the efficiency of its search operations.
(c) In order to complete this code, and return the correct TEAM array, pseudocode to find MINP, the first index in PARTICIPANTS of the CURRENT team, and use it to start the construction of TEAM.
(d) In order to complete this code, and return the correct TEAM array, pseudocode to find the other participants belonging to the CURRENT team, implementing the idea of the closed paths in the TEAM array.
| [0] | [1] | [2] | [3] | [4] | [5] | [6] | [7] | [8] | [9] | [10] | [11] | [12] | [13] | [14] |
|---|
| (3) | 4 | 6 | (5) | 7 | (8) | 10 | 13 | 9 | 0 | 12 | 73 | 14 | 15 | 2 |