Algorithms Flashcards

1
Q

What is an algorithm?

A

An algorithm is a step-by-step procedure or set of rules designed to perform a specific task or solve a particular problem.

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

Define a data structure.

A

A data structure is a way of organizing and storing data to perform operations efficiently.

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

Explain the difference between an array and a linked list.

A

An array is a contiguous memory allocation for elements of the same type while a linked list is a data structure where elements are connected via pointers and can be non-contiguous in memory.

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

What is a sorting algorithm?

A

A sorting algorithm arranges the elements of a list in a particular order such as ascending or descending.

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

Define time complexity in the context of algorithms.

A

Time complexity measures the amount of time an algorithm takes to complete as a function of the size of the input.

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

Explain the concept of recursion.

A

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

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 allowing efficient retrieval of values based on their associated keys.

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

Define Big O notation.

A

Big O notation is used to describe the upper bound on the execution time of an algorithm in terms of its input size.

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

Explain the purpose of a queue in data structures.

A

A queue is a data structure that follows the First In First Out (FIFO) principle where the first element added is the first to be removed.

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

What is a binary search algorithm?

A

A binary search algorithm efficiently finds the position of a target value within a sorted array or list.

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