Flashcards on Sorting and searching algorithms

Sorting and Searching Algorithms: A Student's Guide

1 / 20

What is an algorithm?

An algorithm is a finite set of well-defined, unambiguous instructions to solve a problem or perform a computation. It is a step-by-step procedure tha

Tap to flip · Swipe to navigate

Algorithms and Time Complexity

20 cards

Card 1

Question: What is an algorithm?

Answer: An algorithm is a finite set of well-defined, unambiguous instructions to solve a problem or perform a computation. It is a step-by-step procedure tha

Card 2

Question: What are the key characteristics of an algorithm?

Answer: Key characteristics of an algorithm include its definiteness, effectiveness, finiteness, and input/output.

Card 3

Question: What does 'definiteness' mean for an algorithm?

Answer: Definiteness means each step of the algorithm is precisely defined.

Card 4

Question: What does 'effectiveness' mean for an algorithm?

Answer: Effectiveness means each step of the algorithm can be carried out.

Card 5

Question: What does 'finiteness' mean for an algorithm?

Answer: Finiteness means an algorithm must terminate after a finite number of steps.

Card 6

Question: What does 'input/output' mean for an algorithm?

Answer: Input/output means an algorithm takes zero or more inputs and produces one or more outputs.

Card 7

Question: What is time complexity in the context of algorithms?

Answer: Time complexity is a measure of the amount of time an algorithm takes to run as a function of the length of its input. It describes how the number of

Card 8

Question: Why is Big O notation used in computer science?

Answer: Big O notation is used to classify algorithms according to how their running time or space requirements grow as the input size grows. It provides an u

Card 9

Question: What does O(1) time complexity mean?

Answer: O(1) or Constant Time means the algorithm takes the same amount of time regardless of the input size.

Card 10

Question: Give an example of an algorithm with O(1) time complexity.

Answer: Accessing an element in an array by its index is an example of O(1) time complexity.