Data Structures 6 Flashcards
Binary Search tree
all left descendants < =n < all right descendents 8 / \ 4 10/ \ \2 6 20
Balanced Trees
AVL trees and red-black trees
Complete Binary Trees
“every level of the tree is fully filled, except for the last level. it has to be filled left to right “
Full Binary Tree
a binary tree where every node has zero or 2 children. It is the all or nothing binary tree
Perfect Binary Tree
It is both full and complete. 2k - 1 nodes where k is the height
In-Order Traversal
LDR -> Left, Visit Node, Right.
Pre-Order Traversal
DLR -> Visit Node, Left, Right
Post-Order Traversal
LRD -> Left, Right, Visit NOde
Array advantages
Simple and easy to use and access to elements is O(1)
Array disadvantages
fixed size, one block allocation, and complex position-based insertion
O(1) complexity for access
Array and dynamic arrays time complexity.
O(n) time complexity for accessing elements
lists
Main operations of lists
traversing, insert(), pop()
Main operations of stack
push(), int pop()
Auxiliary operations of stack
int top(), int size(), int empty(), isFull()