Data Structures Flashcards

(42 cards)

1
Q

Primitives

A

int, float, byte, etc. All built from bits.

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

Basic types used to build software

A

Primitives

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

Byte

A

8 bits, 0-255

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

Half a byte

A

Nybble, Hex

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

Integer types

A

Short (2B), Int (4B), Long (8B)

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

Short integer

A

2 bytes

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

int Integer

A

4 bytes

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

Long integer

A

8 bytes

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

Hex

A

Half-byte, 0-f

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

Memory location

A

Pages on physical memory/RAM (frames), or on disk/ROM

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

Frame

A

Page in physical memory

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

Page Replacement steps

A

Find page on disk, find empty/victim frame, write victim frame to disk if dirty, bring new page into memory, update frame table

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

FIFO

A

First-in-first-out, replace oldest page first

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

LRU

A

Least-recently-used, replace page that was called on the longest ago

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

Page vs. Frame

A

Frame is the storage unit/location in memory, page is the stuff being store

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

array indexing directions

A

row / column

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

Array lookup

A

Super fast, but modifying the array sucks

18
Q

Linked Lists

A

Every node references next node. Lookups are slow, but modifying the list is easy.

19
Q

Queue

A

FIFO, built from arrays or lists

20
Q

Stack

A

LIFO, built from arrays or lists

21
Q

Queue terminology

A

Enqueue, dequeue, remove

22
Q

Stack terminology

A

Push, pop, empty

23
Q

Operational Ceiling

A

Limit before failure

24
Q

Limit before failure

A

Operational Ceiling

25
Linear/Serial Search
O(n), starts at one end and moves down the line
26
Binary Search
O(log n), divide at midpoint & repeat, needs ordered list
27
Search starts at one end and moves down the line
Linear/Serial Search
28
Search divides at midpoint & repeat, needs ordered list
Binary Search
29
Hash Function
Maps a key (name) to an integer index of a hash table array / bucket. O(1) ideally, O(n) in practice. Calculates the key based on the data that's being stored.
30
Collision
Multiple keys mapping to the same index--can be resolved by having the bucket itself being a collection, moving shit to the next open spot (open addressing), or using a perfect hash function instead.
31
Multiple keys mapping to the same index
Collision
32
If collision, slapping data in the next free index of the hash table.
Open Addressing
33
Open Addressing
When mapping new key, if there's a collision, just go down the indices until you find a free space. When doing a lookup, the hash function will still return the original index, so you just go down the indices until you find what you're looking for, or find an empty spot.
34
Where shit is stored in hashing
Buckets
35
Bubble Sort
Compare [0] and [1], swap if needed, compare [1] and [2], etc. Then start again, up to len-1, etc. O(n^2)
36
Compare [0] and [1], swap if needed, compare [1] and [2], etc. Then start again, up to len-1, etc. O(n^2)
Bubble Sort
37
Insertion Sort
Make new list, and go down line of original list, placing things into new list in order. O(n^2)
38
Make new list, and go down line of original list, placing things into new list in order. O(n^2)
Insertion Sort
39
Selection Sort
Find min element and move to start, find 2nd to min element and move it into next spot, etc. O(n^2)
40
Find min element and move to start, find 2nd to min element and move it into next spot, etc. O(n^2)
Selection Sort
41
Quicksort
Select pivot, move smaller elements to the left and bigger to the right, then pivot on those two list, etc. O(n log n)
42
Select pivot, move smaller elements to the left and bigger to the right, then pivot on those two list, etc. O(n log n)
Quicksort