And actually, we used essentially these assumptions.

So, recall that we estimated the probability that two elements,

A prime of I and A prime of J are comparative.

And we argued that if any element between them is selected,

the appearance is that they will not become period.

However, if they are equal, so if A prime of A is equal to A prime of J,

this means actually that all the elements in this range are equal.

So if we select any element inside this range, in the middle of this range,

as a pivot, then it is not true that these two elements will go into different

parts with respect to this element, this is just because all of the elements inside

this range are equal, which means that if we partition with respect of this element,

all of the elements in this range will be [INAUDIBLE] this element.

So, they all will be in the left part with respect to this element, okay?

So our analysis doesn't work for equal elements but

let's see what happens in real life.

What happens if we run the greek sort algorithm for

the array in which there are equal elements.

For this, let's use the following online visualization.

This visualization shows how different selection,

different certain algorithms that are formed on different datasets.

So there are eight

certain algorithms here where we are now interested in this QuickSort algorithm.

And there are four different types of datasets.

So the field datasets is just random sequence.

The next one is in sorted sequence,

the next one is a reversed sequence and the next one which is most interesting to

us at the moment is a sequence that contains a few unique elements.

So let's see how the greek sort algorithm performs on the last dataset.

So for this let's just run all the algorithms, on all data sets.

So let's see what happens here.

So you, you may notice now that, for example, have already sorted everything.

And while greek sort have just finished to sort the last, the last data set.

So Greek sort is not, is not so

fast on data sets that contains few unique elements and this is why.

So just consider a dataset that consists

of elements that are all equal to each other.

So all elements are equal to each.

This means that the selection, the partition procedure always