Algorithms Flashcards
What is an algorithm?
An algorithm is a step-by-step procedure or set of rules designed to perform a specific task or solve a particular problem.
Define a data structure.
A data structure is a way of organizing and storing data to perform operations efficiently.
Explain the difference between an array and a linked list.
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.
What is a sorting algorithm?
A sorting algorithm arranges the elements of a list in a particular order such as ascending or descending.
Define time complexity in the context of algorithms.
Time complexity measures the amount of time an algorithm takes to complete as a function of the size of the input.
Explain the concept of recursion.
Recursion is a programming technique where a function calls itself in order to solve a smaller instance of the same problem.
What is a hash table?
A hash table is a data structure that stores key-value pairs allowing efficient retrieval of values based on their associated keys.
Define Big O notation.
Big O notation is used to describe the upper bound on the execution time of an algorithm in terms of its input size.
Explain the purpose of a queue in data structures.
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.
What is a binary search algorithm?
A binary search algorithm efficiently finds the position of a target value within a sorted array or list.