CSE 214 Study Guide - Final Guide: Binary Heap, Binary Tree, Priority Queue

108 views2 pages

Document Summary

Cse 214 study guide: balanced trees, heaps, b trees, 2-3-4 trees. Binary tree where the data contained in each node is greater than or equal to the data contained in its children nodes. Use an array to hold the data. For any node in position i, the left child is in position 2i+1, and the right child is in position 2i +2. The parent to any child is in position (i-1)/2. To insert into a heap, you must first check if there is a space available in the heap array. If there is, you place the new element into the first empty position in the array. Then you have to fix the heap by checking to see if the parent of that new child node is greater or less than the child. You can check using the formula for parent (i-1)/2 to get the parent of the child.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers

Related Documents

Related Questions