Data Structures (Archived Cards) Flashcards
Queues
(Def., Usage, Package & Function)
Def. & Usage:
- linear, store data in first in, first our (FIFO) order
- unlike list or arrays you cannot access elements by index, you can only pull the next oldest element
- used for order sensitive tasks (online order processing, voicemail storage)
Invoke in python:
from collections import deque
q = deque()
q. append(‘a’)
q. append(‘a’)
Stacks
(def., package, function)
Definition
- sequential, last-in, first-out (LIFO)
- last element inserted is considered to top of the stack, the only accessible element
- link of stack of dinner plates
- add or remove plate on top, but
- must move the whole stack to place plate at bottom
Invoke in python:
from collections import deque
Trees
(def., types of nodes, how to invoke)
relation based data structure, specializes in representing hierarchical structures
each tree has a root node that all other nodes brach from, these other nodes are refered to a child nodes
nodes on the same level are called siblings, and nodes with no connected child nodes are calleed leaf nodes
invoked in python by creating a Niode class
Graphs
(def., what they are used for, how to invoke)
relation based data structures with nodes (or vertices) and edges (which connect nodes to each other)
used to represent networks
(telephone network, social networks, etc.)
invoked in python by creating a dictionary where each node is the key and the edges are values