Download AP CS AB 2005 Free Response Questions PDF

TitleAP CS AB 2005 Free Response Questions
TagsComputer Programming Software Engineering Areas Of Computer Science Queue (Abstract Data Type) Advanced Placement
File Size394.8 KB
Total Pages16
Document Text Contents
Page 2

2005 AP
®

 COMPUTER SCIENCE AB FREE-RESPONSE QUESTIONS

1

ERRATUM NOTICE

On pages 9 and 10 of this exam, the third and fourth lines of the comments for the method

successor should read:

// the method runs in time O(h), where h is the height
// of the tree rooted at root

Page 9

2005 AP
®

 COMPUTER SCIENCE AB FREE-RESPONSE QUESTIONS

Copyright © 2005 by College Entrance Examination Board. All rights reserved.
Visit apcentral.collegeboard.com (for AP professionals) and www.collegeboard.com/apstudents (for AP students and parents).

GO ON TO THE NEXT PAGE.

8

3. In this question, assume that the TreeNode class (whose code is provided in the Appendix) has been
modified as shown below to include an additional link to the node’s parent. The following private instance
variable and two public methods have been added to the TreeNode class to provide this link.

private TreeNode parent;

public TreeNode getParent()

{ return parent; }

public void setParent(TreeNode p)
{ parent = p; }

In the following diagrams, the three-node tree on the left is expanded on the right, showing how parent and child
nodes are linked.

Similer Documents