What is key comparison in sorting algorithm?
Answers
Answered by
1
sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Sorting algorithms provide an introduction to a variety of core algorithm concepts, such as big O notation, divide and conquer algorithms, data structures, best-, worst- and average-case analysis, time-space tradeoffs, and lower bounds.
Classification:
Computational complexity (worst, average and best behavior) of element comparisons in terms of the size of the list (n). For typical sorting algorithms, a good behavior is O(n log n) and a bad behavior is O(n2).
Computational complexity of swaps (for "in place" algorithms).
Memory usage (and use of other computer resources). In particular, some sorting algorithms are "in place". This means that they need only O(1) or O(log n) memory beyond the items being sorted and they don't need to create auxiliary locations for data to be temporarily stored, as in other sorting algorithms.
Recursion: Some algorithms are either recursive or non-recursive.
Stability: Stable sorting algorithms maintain the relative order of records with equal keys (i.e., values).
Whether or not they are a comparison sort. A comparison sort examines the data only by comparing two elements with a comparison operator.
General methods: insertion, exchange, selection, merging, etc.
Adaptability: Whether or not the presortedness of the input affects the running time. Algorithms that take this into account are known to be adaptive.
Classification:
Computational complexity (worst, average and best behavior) of element comparisons in terms of the size of the list (n). For typical sorting algorithms, a good behavior is O(n log n) and a bad behavior is O(n2).
Computational complexity of swaps (for "in place" algorithms).
Memory usage (and use of other computer resources). In particular, some sorting algorithms are "in place". This means that they need only O(1) or O(log n) memory beyond the items being sorted and they don't need to create auxiliary locations for data to be temporarily stored, as in other sorting algorithms.
Recursion: Some algorithms are either recursive or non-recursive.
Stability: Stable sorting algorithms maintain the relative order of records with equal keys (i.e., values).
Whether or not they are a comparison sort. A comparison sort examines the data only by comparing two elements with a comparison operator.
General methods: insertion, exchange, selection, merging, etc.
Adaptability: Whether or not the presortedness of the input affects the running time. Algorithms that take this into account are known to be adaptive.
Similar questions