Analysis & Design of Algorithms
Analysis & Design of Algorithms
I nt r o d uc t i o n t o
• Prepared by:-
Sorting
Sagar Virani
Assistant Professor
Computer Engineering
Department
records R and S with the same key and with R appearing before S
9 2 7 5 2 4 3 6 2 2 3 4 5 6 7 9
R S R S
In-place Sort
• An in-place algorithm is an algorithm that does not need an extra
space and produces an output in the same memory that contains the
data by transforming the input ‘in-place’.
• However, a small constant extra space used for variables is allowed.
• This space is O(log n), though sometimes anything in O(n).
Any Questions?