Data Structures Flashcards

1
Q

Data structures

A

These are standardized patterns of code designed to organize one or more variables

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

Arrays

A
  • core to most languages
  • linear collection of variables of same size and often type
  • reserves memory so their contents are adjacent
  • fixed size
  • fixed length that can only be set once (array has to reserve that memory)
  • access all contents using index
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Vectors / Lists

A
  • used if you don’t care about memory adjacency, and need collection that can grow and shrink as needed
  • flexible in size
  • memory is not reserved at initialization
  • often just a wrapper around an array
  • can access elements by an index
  • internally doubles in size when full
  • adding/removing elements causes elements to shift
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Stacks

A
  • LIFO
  • flexible in size
  • new elements are added to the top of the stack. Can only retrieve the top element
  • good for order
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Queues

A
  • FIFO
  • Queues add new elements to bottom
  • good for scheduling
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Linked Lists

A
  • a linear collection without an index
  • made up of nodes (wrappers around the actual element with a link to the next element)
  • accessing particular elements means searching the list
  • can be singly or doubly
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Maps / Dictionaries*

A
  • A collection of nodes structures like an array list, but each node is not aware of any others.
  • each node both wraps the actual variable or object being stored in the map, and also contains a key value that can be used to refer to the node in question directly
How well did you know this?
1
Not at all
2
3
4
5
Perfectly