C949 Flashcards

1
Q

Array

A

An ordered list where each item is directly by a positional index. A data structure that stores subitems. Primary search method, Binary.

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

Linked list

A

Stores ordered list of items in nodes. Each node stores data and has a pointer to the next node. Faster than an array.

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

Hash Table

A

Stores unordered items by mapping(or hashing) each item to a location in an array(or vector)

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

Chaining

A

Handles hash table collision by using a list for each bucket. Each list may store multiple items that map to the same bucket.

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

Bucket

A

Each element in a hash table

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

Hash Key

A

Value used to map an index

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

Modulo hash function

A

(num_keys/num_buckets)

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

Hash table searching

A

Supports fast search, insert and remove. O(1) linear search requires(N).

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

Max-Heap

A

A binary tree that maintains the property that a node’s key is greater than or equal to the node’s children key. The root is always the max key.

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

Heap Storage

A

Heaps are stores using Arrays. If represented by a tree the root node is always entry 0. Works with Tree based data structures.

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

Max-Heap Insert

A

An insert into a max-heap starts by inserting the node in the tree’s last level. Then swapping the node with it’s parent until no violation occurs.

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

Max-heap remove

A

Always removes the root. Each node is swapped until no violation occurs.

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

Percolating

A

The upward movement of a node in a heap.

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

Min-Heap

A

Like a max-heap, but a node’s key is less than or equal to it’s children’s keys.

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

Heap parent and child indices

A

Because heaps do not have a node structure nodes are referred to by index. Parent index for a node at index 12: ((12-1) // 2) = 5, child index for a node at index 6: 2* 6 + 2 = 14 **Double # and add 1, double # and add 2.

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

Priority Queues with Heaps

A

Both functions return the value in the root, but the Pop() function removes the value and the Peek function does not. Pop and Push worst case is 0(logN) and Peek, IsEmpty and GetLength is worst case O(1)

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

Array Based List

A

A list ADT implemented using an array. Allows for operations such as append, prepend, insert after, remove and search.

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

Linked List vs Array

A

If a program requires fast insertion a linked list is a better choice.

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

Abstract Data Type(ADT)

A

A data type described by a predefined user operation. Such as “insert data at rear” without indicating how each operation is implemented.

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

Array in Java

A

Generic class that supports different data types.

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

Tuple

A

A container with ordered elements.

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

Stack

A

An ADT with “Last in first out” rule. Pop and Peek cannot be used in empty list.

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

Stack and Queue in Python

A

Can be implemented using a class with a single linked list.

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

Queue

A

An ADT in which items are inserted at the end and removed from the front.(Linked List, Array, Vector)

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

Linked List

A

A linear data structure that consists of nodes that link to the next node.

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

Double Linked List

A

A data structure that can also include a reference to the head node. If no variable is assigned returns None or Null.

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

Dequeue

A

Short for double ended queue. Items can be inserted and removed from the front and back.

28
Q

Bag

A

An ADT for storing items in which the order does not matter and duplicates items are allowed.

29
Q

Set

A

ADT for a collection of items. No duplicate items. (BST/Hash Table)

30
Q

Priority Queue

A

A queue where each item has a priority. Higher are closer to the front.(Heap)

31
Q

Dictionary(Map)

A

Keys and Value Pairs (BST, Hash Table)

32
Q

Graph

A

A data structure for representing connections among items. Consists of vertices connected by edges.

33
Q

Vertex

A

A line item in a graph. Also called nodes.

34
Q

Edge

A

A connection between two vertices

35
Q

Graph Weight

A

The graph in which weight is associated with edges

36
Q

Graph Direction

A

The graph in which all the edges are bidirectional

37
Q

Binary Tree

A

Each node has up to two children

38
Q

Leaf

A

A node with no children

39
Q

Internal Node

A

A node with at least on child

40
Q

Depth

A

The number of edges away from the root.

41
Q

Height

A

The largest depth of any node.

42
Q

Preorder traverasal

A

Root, left, right

43
Q

Bubble sort

A

Sorting Algorithm that swaps adjacent elements if the second element is less than the first element. Has a runtime of O(N2) N is the number of elements in a list.

44
Q

Bucket sort

A

Sorting algorithm that individually sorts. Useful when input is uniformly distributed over a range.

45
Q

Merge Sort

A

Continually splits a list in half. Used with a recursive function

46
Q

Big O complexity

A

Best to worst: O(1), o(logN), O(n), O(nlogN), O(n^2), O(2^N), O(nl)

47
Q

Radix Sort

A

10 buckets

48
Q

Interval Search

A

Divides the data in half until it finds the target. Fastest for sorted data.

49
Q

Record

A

Data structure for items that are related.

50
Q

Class

A

A term for a template to create an object.

51
Q

Characteristics of an algorithm

A

Uses an agnostic code repository.

52
Q

O(1)

A

Constant time. Always at the top.

53
Q

O(N)

A

Linear time. Twice as many variables means twice as much time.

54
Q

O(log N)

A

Logarithmic time. Splits the variables in half with each search. Cutting time.

55
Q

O(N^2)

A

Quadratic time. Checks every variable against every other variable. Twice as many variables means four times as long.

56
Q

O(N^3)

A

Exponential. Longest

57
Q

Quicksort

A

a sorting algorithm that repeatedly partitions the input into low and high parts (each unsorted), and then recursively sorts each of those parts. To partition the input, quicksort chooses a pivot to divide the data into low and high parts. The pivot can be any value within the array, commonly the value of the middle array element. Runtime O(N log N)

58
Q

Selection Sort

A

Selection sort is a sorting algorithm that treats the input as two parts, sorted and unsorted, and repeatedly selects the proper next value to move from the unsorted part to the end of the sorted part. Runtime O(N^2)

59
Q

Insertion Sort

A

a sorting algorithm that treats the input as two parts, sorted and unsorted, and repeatedly inserts the next value from the unsorted part into the correct location in the sorted part. Runtime O(N^2)

60
Q

Merge Sort

A

Merge sort is a sorting algorithm that divides a list into two halves, recursively sorts each half, and then merges the sorted halves to produce a sorted list. The recursive partitioning continues until a list of one element is reached, as a list of one element is already sorted. Runtime O(N log N)

61
Q

Radix Sort

A

Radix sort is a sorting algorithm designed specifically for integers. The algorithm makes use of a concept called buckets and is a type of bucket sort.

Any array of integer values can be subdivided into buckets by using the integer values’ digits. A bucket is a collection of integer values that all share a particular digit value

62
Q

Bubble Sort

A

a sorting algorithm that iterates through a list, comparing and swapping adjacent elements if the second element is less than the first element. Runtime O(N^2)

63
Q

Quickselect

A

an algorithm that selects the
smallest element in a list. Ex: Running quickselect on the list (15, 73, 5, 88, 9) with k = 0, returns the smallest element in the list, or 5.

64
Q

Bucket Sort

A

a numerical sorting algorithm that distributes numbers into buckets, sorts each bucket with an additional sorting algorithm, and then concatenates buckets together to build the sorted result.

65
Q
A