3-11-1

3-11-1 - Problem Solving with Computers-II CS 24 March 11,...

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

View Full Document Right Arrow Icon
Problem Solving with Computers-II CS 24 March 11, 2010 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
Announcements Deadlines Lab 9: Friday 5 pm Programming project & extra credit: Sunday 5 pm Final Wed March 17, 8-11 am Final review Tuesday 3/16 6-8 HFH 1132 (Harry) Office hours Monday 3/15 5-7 pm (Saiph) Topics/format posted coming weekend Allowed one sheet of paper 2
Background image of page 2
Recap Tree and BST ADT Recursive implementations Iterative implementations Heap Priority queue What is the difference? 3
Background image of page 3

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

View Full DocumentRight Arrow Icon
Lecture Plan Discussion of Stack model Exception Course review Instructor & course survey 4
Background image of page 4
5 ReheapDown ReheapDown(int root, int bottom) { int maxChild ; int rightChild ; int leftChild ; leftChild = root * 2 + 1 ; rightChild = root * 2 + 2 ;
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 ReheapDown (contd.) if (leftChild <= bottom) //otherwise, no need to Reheap { if (leftChild == bottom) maxChild = leftChild; else { if (elements[leftChild] <= elements[rightChild]) maxChild = rightChild; else maxChild = leftChild; }; if (elements[root] < elements[maxChild]) { Swap(elements[root], elements[maxChild]); ReheapDown(maxChild, bottom); } } }
Background image of page 6
7 Restoring order property
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 ReheapDown ReheapDown(int root, int bottom) { int maxChild ; int rightChild ; int leftChild ; leftChild = root * 2 + 1 ; rightChild = root * 2 + 2 ;
Background image of page 8
9 ReheapDown (contd.) if (leftChild <= bottom) //otherwise, no need to Reheap { if (leftChild == bottom) maxChild = leftChild; else { if (elements[leftChild] <= elements[rightChild]) maxChild = rightChild; else maxChild = leftChild; }; if (elements[root] < elements[maxChild]) { Swap(elements[root], elements[maxChild]); ReheapDown(maxChild, bottom); } } }
Background image of page 9

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

View Full DocumentRight Arrow Icon
Exception An exception is a unusual, often unpredictable  event,  detectable by software  or hardware , that requires 
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 30

3-11-1 - Problem Solving with Computers-II CS 24 March 11,...

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

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