225_15_heap_array

# 225_15_heap_array - 1 Assignment 2: Part A due Wed. Oct....

This preview shows pages 1–6. Sign up to view the full content.

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

View Full Document

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Assignment 2: Part A due Wed. Oct. 12. Part B due Fri. Oct. 14. Midterm: Tues. Oct. 18, in class. Midterm tutorial: Sunday Oct. 16, 1pm in ECS 116. Bring any questions you have about old midterm exams. No office hours Oct. 19-21 (at conference) To build a heap with n nodes non-recursively: For (i= f(n) ; i >=0; i--) Bubble-down the data value at position i. What should f(n) be to make this work for arbitrary n? 3 Max-heap: The data value at each node is greater than or equal to the data values of its children. 4 One way to build a heap: Add the new entry in the position which is the next slot of a left-complete binary tree. Then bubble-up to restore the heap property. Max-heap: The data value at each node is greater than or equal to the data values of its children. 5 Timing: To build the heap: The roughly n/2 nodes at the bottom of the heap...
View Full Document

## This note was uploaded on 01/15/2012 for the course CSC 225 taught by Professor Valerieking during the Spring '10 term at University of Victoria.

### Page1 / 22

225_15_heap_array - 1 Assignment 2: Part A due Wed. Oct....

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

View Full Document
Ask a homework question - tutors are online