SYSC2002_2001_Winter

SYSC2002_2001_Winter - . , DURATION: Department Course...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
r!} BP .. , @ ~ Carleton UNIVERSITY 94.202D Final EXAMINATION Winter 2001 DURATION: 3 HOURS No. of Students: 79 Department Name & Course Number: Systems & Computer Engineering 94 -202D Course Instructor(s) J. Bryant AUTHORIZED MEMORANDA No calculators, 1 8.5x11 sheet of notes both sides Students MUST count the number of pages in this examination question paper before beginning to write, and report any discrepancy to a proctor. This question paper has 11 pages. This examination question paper MAY NOT be taken from the examination room. In addition to this, question paper, students require: an examination booklet yesO n~ a Scantron sheet yesO nO4]{ Student Name: Student Number:.' , Question 1 (8 marks) Given the tree class definitions below, write a method which returns'true if the tree is sorted and false if it isn't. public class Tree { m~:§~~ private class Node { int key; Node left, right; } private Node root; . "" -.//yourmethod. .. --public boolean isSorted () { } } You will probably want to have "i~_Sorted" call another method (if you don't, this could be a long exam) This is fine as long as you write the other method. Write your method(s) in the space on the f~_llbwingpage. ---===;=~:.c~ ~"'" ',; .=: = ---~~-- ~~:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
" gp .C~ public boolean isSorted () { ..IEEE Carleton " , ~ , - } 94.202 Page 2. of 11 ..-" , ,..'
Background image of page 2
.~p .~J ~~:ttt-~;~ Question 2 (8 marks) ~~~~_.~~::;;;;. .J In addition to the RR and LL rotations covered in assignment #8, tree balancing can also require LR and RL rotations. The effects of an LR rotation are illustrated below. " After rotation .- .. Before rotation In the space on the next page, write a method which perfonns an LR rotation. Your method should accept a reference to the subtree's original root node (i.e. node "~" in the diagram) and return a reference to the subtree's new root node (i.e. node "c" in the diagram). NO SEARCHING IS REQUIRED, AND YOU DO NOT HAVE TO WORRY ABOUT UPDATING
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/24/2010 for the course SYSC 2002 taught by Professor Unknown during the Fall '07 term at Carleton.

Page1 / 11

SYSC2002_2001_Winter - . , DURATION: Department Course...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online