0% found this document useful (0 votes)
13 views2 pages

Algorithm Analysis - Types, Time, & Examples

There are three types of algorithm analysis: time complexity analysis measures how running time increases with input size, space complexity analysis measures memory usage, and correctness analysis determines if the output is always correct. Time complexity, usually measured with Big O notation, indicates how efficiently an algorithm scales to larger inputs. Six common sorting algorithms are bubble, selection, insertion, merge, quick, and heap sort, while two search algorithms are linear and binary search, with binary search being more efficient for large sorted arrays.

Uploaded by

johndoland19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Algorithm Analysis - Types, Time, & Examples

There are three types of algorithm analysis: time complexity analysis measures how running time increases with input size, space complexity analysis measures memory usage, and correctness analysis determines if the output is always correct. Time complexity, usually measured with Big O notation, indicates how efficiently an algorithm scales to larger inputs. Six common sorting algorithms are bubble, selection, insertion, merge, quick, and heap sort, while two search algorithms are linear and binary search, with binary search being more efficient for large sorted arrays.

Uploaded by

johndoland19
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Algorithm Analysis: Types, Time, & Examples

Havi
List and explain the three types of analysis one can perform on Algorithms
What is time complexity and what does it indicate?
List six sort algorithms
List two search algorithms

3/3

There are three types of analysis that one can perform on algorithms:

Time complexity analysis: This involves analyzing how the running time of an algorithm
increases as the size of the input increases. It measures the amount of time an algorithm takes
to execute as the input size grows, usually in terms of big O notation.

Space complexity analysis: This involves analyzing how much memory an algorithm requires to
execute as the size of the input increases. It measures the amount of memory an algorithm
uses as the input size grows, also typically in terms of big O notation.

Correctness analysis: This involves analyzing whether an algorithm produces the correct output
for all possible inputs.

Time complexity refers to the amount of time an algorithm takes to execute as the size of the
input increases. It is usually measured in terms of the "big O" notation, which describes the
upper bound on the time an algorithm takes to execute. Time complexity is important because it
helps us understand how an algorithm will scale as the input size grows, and allows us to
compare the efficiency of different algorithms.

Six sorting algorithms are:

Bubble sort: This is a simple sorting algorithm that repeatedly steps through the list, compares
adjacent elements and swaps them if they are in the wrong order.

Selection sort: This is another simple sorting algorithm that sorts an array by repeatedly finding
the minimum element from unsorted part and putting it at the beginning.

Insertion sort: This algorithm sorts the array by shifting elements one by one to the right and
inserting the current element in its correct position.
Merge sort: This is a divide-and-conquer algorithm that recursively divides the input list into
smaller sub-lists, sorts them and then merges them to produce a sorted output.

Quick sort: This is another divide-and-conquer algorithm that selects a pivot element and
partitions the array around the pivot, sorting the sub-arrays recursively.

Heap sort: This algorithm sorts an array by first building a binary heap from the input array, and
then repeatedly extracting the maximum element and rebuilding the heap until the array is
sorted.

Two search algorithms are:

Linear search: This algorithm searches for a given element in an array by sequentially checking
each element of the array until a match is found or the entire array is searched.

Binary search: This algorithm searches for a given element in a sorted array by repeatedly
dividing the search interval in half and eliminating the half where the element cannot be present.
It is a more efficient algorithm than linear search for large arrays.

You might also like