Past-paper question · 2017 May-June · Paper 42 · Q2(e)

Question 2(e) 2017 · May-June · Paper 42 · 5 marks

Original past-paper question for 2(E)
Original past-paper question for 2(E)
Original past-paper question for 2(E)
Original past-paper question for 2(E)
Original past-paper question for 2(E)
Original past-paper question for 2(E)
Original past-paper question for 2(E)
Reveal official mark-scheme answer Official mark-scheme answer for 2(E)

Official answer for Question 2

Part (e)

Question 1

mark per bullet

Question 5

  • test for base case (null/-1)
  • recursive call for left pointer
  • output data
  • recursive call for right pointer
  • order, visit left, output, visit right
✓
IF Pointer <> NULL

Question 1

✓
THEN
✓
TraverseTree(Tree[Pointer].LeftPointer)

Question 1

✓
OUTPUT Tree[Pointer].Data
✓
1 + 1
✓
TraverseTree(Tree[Pointer].RightPointer)

Question 1

✓
ENDIF
✓
ENDPROCEDURE
✓
9608/42
✓
Cambridge International AS/A Level – Mark Scheme
✓
May/June 2017
✓
PUBLISHED
✓
Question
✓
Answer
✓
Marks

Mark scheme 9608_s17_ms_42.pdf →

Show text version of question

Question 2

Part (e)

Question 2

An ordered binary tree Abstract Data Type (ADT) has these associated operations:

  • create tree
  • add new item to tree
  • traverse tree

The binary tree ADT is to be implemented as a linked list of nodes.

Each node consists of data, a left pointer and a right pointer.

Part (e)

The traverse tree operation outputs the data items in alphabetical order. This can be written

as a recursive solution.

Complete the pseudocode for the recursive procedure TraverseTree.

PROCEDURE TraverseTree(BYVALUE Pointer : INTEGER)

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

...................................................................................................................................................

ENDPROCEDURE

[5]

Question 10

Topic relevance

Why this question appears here

98% assigned-topic match · Computational thinking and problem-solving › Recursion

Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.

Permanent source page: Educate A Change · From 9608_s17_qp_42.pdf

Keep practising this topic