C949v4 Study Guide Flashcards

1
Q

What is the percentage of the assessment that explains algorithms?

A

29%

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

What type of search algorithm is linear search?

A

A basic search algorithm that checks each element sequentially.

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

What is binary search?

A

A search algorithm that finds the position of a target value in a sorted array by repeatedly dividing the search interval in half.

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

Define Big O in the context of time complexity.

A

A notation used to describe the upper limit of the time complexity of an algorithm.

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

What is the time complexity of Selection Sort?

A

O(n^2)

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

What is the time complexity of Merge Sort?

A

O(n log n)

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

What does .pop() do in stacks?

A

Removes and returns the top element from the stack.

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

What is a hash table?

A

A data structure that uses a hash function to map keys to indices of an array for efficient storage and retrieval.

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

What is the main distinction of a tuple?

A

Tuples are immutable, meaning their values cannot be changed.

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

Fill in the blank: A _______ follows the Last-In-First-Out (LIFO) principle.

A

stack

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

What is garbage collection?

A

A process by which a computer’s memory is automatically managed, freeing up memory no longer used.

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

What are the two possible values of a Boolean data type?

A

true or false

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

What is the function of a queue?

A

A collection of elements that follows the First-In-First-Out (FIFO) principle.

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

What does a priority queue do?

A

Dequeues elements based on their priority rather than their insertion order.

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

What is a binary search tree?

A

A binary tree where each node has at most two children, with the left child being less than the parent and the right child being greater.

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

What are the main operations of a deque?

A
  • append()
  • appendleft()
  • pop()
  • popleft()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is the purpose of the modulo operator in hash tables?

A

To compute the index for storing the key in the hash table.

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

What is the average-case time complexity for basic operations in hash tables?

A

O(1)

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

What does tree traversal refer to?

A

The process of visiting each node in a tree in a specific order.

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

What are the three types of tree traversal?

A
  • Inorder Traversal
  • Preorder Traversal
  • Postorder Traversal
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is the definition of a set?

A

An unordered collection of unique elements.

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

What does the term ‘linked allocation’ refer to?

A

A memory allocation technique where memory is allocated in linked nodes.

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

What is the difference between assignment and comparison in programming?

A

Assignment uses = to assign a value, while comparison uses == to check for equality.

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

What is the definition of a stack?

A

A linear data structure that follows the Last In First Out (LIFO) principle.

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

True or False: A dequeue allows adding and removing elements only from one end.

A

False

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

What is a linked list?

A

A data structure consisting of a sequence of nodes, each containing an element and a reference to the next node.

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

What is the main purpose of a dictionary in programming?

A

To store key-value pairs where each key maps to a value.

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

What does ‘peek’ do in a stack?

A

Returns the top element of the stack without removing it.

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

What is the underlying data structure of a priority queue?

A

Heap

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

What is the syntax to create a list in Python?

31
Q

What does the ‘append()’ command do in a list?

A

Adds an element to the end of the list.

32
Q

What is a dictionary?

A

A collection of key-value pairs where each key maps to a value.

33
Q

What does the ‘Get’ operation do in a dictionary?

A

Returns the value associated with a specified key.

34
Q

What is the purpose of the ‘Set’ operation in a dictionary?

A

Sets the value associated with a specified key.

35
Q

What does the ‘Delete’ operation do in a dictionary?

A

Removes a key-value pair from the dictionary.

36
Q

What is a hash table?

A

A data structure that uses hashing to store and retrieve key-value pairs efficiently.

37
Q

Define hashing in the context of hash tables.

A

The process of converting a key into an index that can be used to access a value in the hash table.

38
Q

What is chaining in hash tables?

A

A method for handling collisions by storing multiple key-value pairs in the same index.

39
Q

What is a hash key?

A

The result of hashing a key to determine its index in the hash table.

40
Q

What method is commonly used for hashing keys?

A

Modular Arithmetic.

41
Q

What is an array?

A

A data structure that stores a fixed-size sequence of elements of the same type in contiguous memory locations.

42
Q

How are elements compared in an array?

A

Elements are compared by their index.

43
Q

What is the time complexity for inserting an element at the end of an array?

44
Q

What is the time complexity for deleting an element from the end of an array?

45
Q

How are elements accessed in an array?

A

Using their index.

46
Q

What is the structure of arrays?

A

Arrays have a flat structure.

47
Q

What is a linked list?

A

A data structure that consists of a sequence of nodes, each containing an element and a reference to the next node.

48
Q

How are elements compared in a linked list?

A

Elements are compared by their value.

49
Q

What is the time complexity for inserting an element at the beginning of a linked list?

50
Q

What is the time complexity for deleting a known node from a linked list?

51
Q

How are elements accessed in a linked list?

A

By traversing the list from the beginning or end.

52
Q

What is a doubly linked list?

A

A data structure that consists of a sequence of nodes, each containing an element and references to the previous and next nodes.

53
Q

What is the time complexity for inserting an element at the beginning of a doubly linked list?

54
Q

How are elements accessed in a doubly linked list?

A

By traversing the list from the beginning or end.

55
Q

What defines a queue data structure?

A

A structure that follows the First-In-First-Out (FIFO) principle.

56
Q

What is the time complexity for inserting an element into a queue?

57
Q

What is the time complexity for deleting an element from a queue?

58
Q

What defines a stack data structure?

A

A structure that follows the Last-In-First-Out (LIFO) principle.

59
Q

What is the time complexity for inserting an element into a stack?

60
Q

What is the time complexity for deleting an element from a stack?

61
Q

What is a binary tree?

A

A hierarchical data structure consisting of nodes connected by edges, where each node has at most two children.

62
Q

How are nodes compared in a binary tree?

A

Nodes are compared by their value.

63
Q

What is the method for inserting nodes in a binary tree?

A

By finding the appropriate location based on their value.

64
Q

What is a heap?

A

A specialized tree-based data structure used to maintain the maximum or minimum element in a collection.

65
Q

What defines a min-heap?

A

A binary heap where the value of each parent node is less than or equal to its children.

66
Q

What defines a max-heap?

A

A binary heap where the value of each parent node is greater than or equal to its children.

67
Q

How are nodes represented in a binary heap?

A

As a list, where the root node is at index 1.

68
Q

What is a graph?

A

A collection of nodes (vertices) connected by edges.

69
Q

What is the difference between directed and undirected graphs?

A

Directed graphs have edges with direction, while undirected graphs have edges with no direction.

70
Q

What are vertices in a graph?

A

The nodes in a graph.

71
Q

What are the methods for inserting elements in a graph?

A

By adding new vertices or edges.

72
Q

What is indexing in data structures?

A

The method used to access individual elements or nodes within a data structure.

73
Q

How does the hierarchy of a data structure impact indexing?

A

Linear structures like arrays are often accessed by index, while hierarchical structures like trees may use traversal methods.