Prep Guide Flashcards

1
Q

What is a data structure?

A

A data structure is a way of organizing and storing data in a computer so that it can be accessed and modified efficiently.

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

What is an algorithm?

A

An algorithm is a step-by-step procedure or formula for solving a problem or accomplishing some end.

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

What is the difference between an array and a linked list?

A

An array stores elements of the same type in contiguous memory locations, while a linked list stores elements in nodes that are not necessarily adjacent in memory.

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

What is a stack?

A

A stack is a data structure that follows the Last In, First Out (LIFO) principle, where elements are inserted and removed from the same end.

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

What is a queue?

A

A queue is a data structure that follows the First In, First Out (FIFO) principle, where elements are inserted at the rear and removed from the front.

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

What is a binary search tree?

A

A binary search tree is a data structure that allows for efficient search, insertion, and deletion operations, where each node has at most two children.

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

What is a hash table?

A

A hash table is a data structure that stores key-value pairs, using a hash function to map keys to index locations for efficient retrieval.

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

What is a sorting algorithm?

A

A sorting algorithm is an algorithm that puts elements of a list in a certain order, such as numerical or lexicographical.

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

What is the time complexity of binary search?

A

The time complexity of binary search is O(log n), where n is the number of elements in the array.

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

What is the purpose of Big O notation?

A

Big O notation is used to describe the upper bound of the time or space complexity of an algorithm in terms of the input size.

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

What is recursion?

A

Recursion is a programming technique where a function calls itself in order to solve smaller instances of the same problem.

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

What is dynamic programming?

A

Dynamic programming is a method for solving complex problems by breaking them down into simpler subproblems and solving each subproblem only once.

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

What is an adjacency list?

A

An adjacency list is a way to represent a graph as a collection of linked lists, where each list represents the neighbors of a vertex.

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

What is a priority queue?

A

A priority queue is a data structure that allows for efficient retrieval of the highest (or lowest) priority element.

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

What is a trie?

A

A trie is a tree-like data structure used to store a dynamic set of strings, where each node represents a common prefix of the strings.

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

What is a heap?

A

A heap is a specialized tree-based data structure that satisfies the heap property, where the key of each node is either greater than or equal to (max heap) or less than or equal to (min heap) the keys of its children.

17
Q

What is the difference between breadth-first search and depth-first search?

A

Breadth-first search explores all neighbor nodes at the present depth prior to moving on to the nodes at the next depth level, while depth-first search explores as far as possible along each branch before backtracking.

18
Q

What is memoization?

A

Memoization is an optimization technique used to store the results of expensive function calls and return the cached result when the same inputs occur again.

19
Q

What is the significance of time complexity analysis?

A

Time complexity analysis helps in understanding how the runtime of an algorithm grows with the input size, enabling comparisons of efficiency among different algorithms.

20
Q

What is the difference between a singly linked list and a doubly linked list?

A

A singly linked list allows traversal only in one direction, while a doubly linked list allows traversal in both directions.

21
Q

What is the difference between a breadth-first search and a depth-first search?

A

Breadth-first search explores all neighbor nodes at the present depth prior to moving on to the nodes at the next depth level, while depth-first search explores as far as possible along each branch before backtracking.

22
Q

What is the space complexity of quicksort?

A

The space complexity of quicksort is O(log n) on average, where n is the number of elements in the array.

23
Q

What is the difference between a binary tree and a binary search tree?

A

A binary tree can have any value in each node, while a binary search tree follows the property that the left subtree of a node contains only nodes with values less than the node’s value, and the right subtree contains only nodes with values greater than the node’s value.

24
Q

What is the difference between a graph and a tree?

A

A tree is a type of graph that contains no cycles and has a single root, while a graph can have cycles and multiple disconnected components.