2.1.Algorithms Flashcards
Linear Search
A search algorithm that works by checking each element in a list one by one, and returning the target value when found.
Binary Search
A more efficient search algorithm that works on sorted lists, where the target value is compared with the midpoint to halve the search space.
Midpoint
In binary search, the midpoint is calculated using the formula: (LowestIndex + HighestIndex) / 2.
Bubble Sort
A simple sorting algorithm that compares adjacent elements and swaps them if they are in the wrong order, continuing until no swaps are needed.
Pass (Bubble Sort)
A single cycle of the Bubble Sort algorithm where each pair of adjacent elements is compared and swapped if necessary.
Merge Sort
A more efficient sorting algorithm that divides the dataset into smaller sub-sets, then merges them in the correct order.
Insertion Sort
A sorting algorithm where elements are inserted into their correct position one at a time, by shifting larger elements to the right.
Sorting Algorithms
Algorithms used to rearrange elements in a list or array into a specific order, such as ascending or descending.
Decomposition
Breaking a large problem into smaller, manageable sub-problems to make it easier to solve.
Abstraction
Removing unnecessary details and leaving only the most important aspects of a problem to focus on.
Flowchart
A diagram used to represent algorithms, with shapes that indicate processes, decisions, and the flow of control.
Pseudocode
A method of writing algorithms using simple, plain language to describe each step in the process.
Efficiency (Algorithms)
The performance of an algorithm in terms of time and memory usage, with more efficient algorithms requiring fewer resources.
Algorithm
A sequence of instructions used to perform a task or solve a problem.
Searches
The number of comparisons or steps taken by a search algorithm to find a target value in a list.
Sorting
The process of arranging items in a specific order, typically ascending or descending.
Merge Sort Efficiency
Merge sort is more efficient than bubble sort and insertion sort when sorting large datasets, but uses more memory.
Bubble Sort Efficiency
Bubble sort is easier to understand than merge or insertion sort but is very inefficient with longer lists or datasets.
Insertion Sort Efficiency
Insertion sort is simple to implement but very inefficient with large datasets.
Recursive Algorithm
An algorithm that calls itself with modified parameters to solve smaller instances of a problem.
Divide and Conquer
A method used in merge sort where the dataset is divided into smaller sub-datasets, processed separately, and then merged.
Big-O Notation
A mathematical notation used to describe the performance or complexity of an algorithm in terms of time and space.
Best, Worst, and Average Case
Terms used to describe the efficiency of an algorithm in different situations: best case (minimum), worst case (maximum), and average case.