Data Structures Flashcards

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
Q

Linear/Serial Search

A

O(n), starts at one end and moves down the line

26
Q

Binary Search

A

O(log n), divide at midpoint & repeat, needs ordered list

27
Q

Search starts at one end and moves down the line

A

Linear/Serial Search

28
Q

Search divides at midpoint & repeat, needs ordered list

A

Binary Search

29
Q

Hash Function

A

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
Q

Collision

A

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
Q

Multiple keys mapping to the same index

A

Collision

32
Q

If collision, slapping data in the next free index of the hash table.

A

Open Addressing

33
Q

Open Addressing

A

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
Q

Where shit is stored in hashing

A

Buckets

35
Q

Bubble Sort

A

Compare [0] and [1], swap if needed, compare [1] and [2], etc. Then start again, up to len-1, etc. O(n^2)

36
Q

Compare [0] and [1], swap if needed, compare [1] and [2], etc. Then start again, up to len-1, etc. O(n^2)

A

Bubble Sort

37
Q

Insertion Sort

A

Make new list, and go down line of original list, placing things into new list in order. O(n^2)

38
Q

Make new list, and go down line of original list, placing things into new list in order. O(n^2)

A

Insertion Sort

39
Q

Selection Sort

A

Find min element and move to start, find 2nd to min element and move it into next spot, etc. O(n^2)

40
Q

Find min element and move to start, find 2nd to min element and move it into next spot, etc. O(n^2)

A

Selection Sort

41
Q

Quicksort

A

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
Q

Select pivot, move smaller elements to the left and bigger to the right, then pivot on those two list, etc. O(n log n)

A

Quicksort