We lack to class an marshal A[1..n] using readysort, where n is a susceptibility of 2. Suppose that at entire recursive raze of readysort, we disagree the marshal accurately in half (that is, the apostacy q disagrees A[p..r] into brace subarrays A[p..q] and A[q + 1..r] with corresponding compute of atoms (r – p + 1)/2). What is the general occasion of readyclass in this event? Please pointed this general occasion in O-notation, using the best asymptotic frisk you can meet. Justify your counterpart. If n is referable a susceptibility of 2, does the best asymptotic frisk on the general occasion for readyclass with this half-and-half disagree substitute?
In ready class we screen marshal in brace compressiveness abutting pivot atom and class them. It is a disunite and vanquish algorithm.
T(n) = T(k) + T(n-k-1) + theta(n)
Where k is the atom which is smaller then pivot atom and n-k-1 atom is superior then pivot.
In best event K = n/2
T(n) = T(n/2) + T(n/2) + theta(n)
= 2T(n/2) + theta(n)
by relieve event of subdue theorm algorithm
No it referable going to substitute As from recursive tree we can meet the in best event top of tree is log n simply.
So occasion complication is referable going to substitute.