Data Structures (Archived Cards) Flashcards

1
Q

Queues

(Def., Usage, Package & Function)

A

Def. & Usage:

  1. linear, store data in first in, first our (FIFO) order
  2. unlike list or arrays you cannot access elements by index, you can only pull the next oldest element
  3. 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’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Stacks

(def., package, function)

A

Definition

  1. sequential, last-in, first-out (LIFO)
  2. last element inserted is considered to top of the stack, the only accessible element
  3. link of stack of dinner plates
    1. add or remove plate on top, but
    2. must move the whole stack to place plate at bottom

Invoke in python:

from collections import deque

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Trees

(def., types of nodes, how to invoke)

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Graphs

(def., what they are used for, how to invoke)

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly