Data structures Flashcards
Abstract Data Type (ADT)
An interface for interacting with data
ADT Examples
Lists, stacks, sets, queues, maps, trees
Data Structure
Implementation of ADT
Data Structure Examples
Array, Linked List, Stack, Queue, Binary Tree, BST, Heap, Hash Table
Hash Function
maps an object (of some type) to an integer
Hash Map Drawbacks
Requires a lot of extra memory and hash function must avoid collisions
Root
Top node in a tree
Siblings
Nodes with the same parents
Descendant
Node reachable by repeated proceeding from parent to child
Ancestor
Node reachable by repeaded proceeding from child to parent
Leaf
A node with no children
Edge
Connection between one node to another
Path
Sequence of nodes and edges connecting a node with a descendant
Level
The level of a node is defined by 1 + the number of connections between the node and the root
Height
The height of a node is the number of edges on the longest downward path between the root and the leaf
BST
node-based data structure in which each node has no more than two child nodes. Each child must either be a leaf node or the root of another binary search tree. The left sub-tree contains only nodes with keys less than the parent node; the right sub-tree contains only nodes with keys greater than the parent node.