CPSC 259 FInal

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/17

flashcard set

Earn XP

Description and Tags

please let me pass

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

18 Terms

1
New cards

Binary Heap

Complete Binary Tree

2
New cards

Hashing Formula

knowt flashcard image
3
New cards

Binary Heap: Min Heap

Value of a node is no greater than its childrens values

4
New cards

Binary Heap: Max Heap

Value of a node is at least as large as its childrens values

5
New cards

Perfect tree

full and complete

6
New cards

full tree

every node has 0 or 2 childrena binary tree where every node has either zero or two children

7
New cards

complete tree

all leaves are full except last level

8
New cards

max nodes in a tree

n = (k^h-1)/(k-1)
n = max nodes

k = #ary

h = height

9
New cards

min heap formulas

child >= parent

<p>child &gt;= parent</p>
10
New cards

remove min/max for heap

  1. replace root with last in array

  2. bubble down

    1. for min heap swap with smaller child (child >= parent)

    2. max heap swap with bigger child (parent >= child)

11
New cards

insertion for heaps

  • Add the new element to the end of the heap (next available position).

  • Bubble up the new element to restore the heap property:

12
New cards

PreOrder Traversal

knowt flashcard image
13
New cards

InOrder Traversal

knowt flashcard image
14
New cards

PostOrder Traversal

knowt flashcard image
15
New cards

max nodes in a tree

knowt flashcard image
16
New cards

height of a tree

knowt flashcard image
17
New cards

max size of a tree

knowt flashcard image
18
New cards

setting up a dummy node with malloc

struct listNode* result = = (struct ListNode*)malloc(sizeof(struct ListNode));