"here the key thing is that always choose the highest or smallest element as pivot so that recurrence relation become
T(n)=T(n-1)+O(n) it will lead to worst case time complexity."
break down the question for smaller problem and observe the pattern.
for array of size 3
here in worst case the pivot selection may follow the order:
1-> 3-> 2.
1-> 2-> 3.
3-> 2-> 1
3-> 1-> 2
so total 4 list orderings are possible (i.e. {2->3->1} {3->2->1} { 1->2->3} {2->1->3}) i.e.$2^{n-1}$ (n is number of elements in array)
for array of size 4:
pivot selection can be done in following 8 ways for worst case:
1->2->3->4
1->4->3->2
1->4->2->3
1->2->4->3
4->3->2->1
4->3->1->2
4->1->3->2
4->1->2->3
total $2^{n-1}$ $2^{4-1}$=8
so for 7 elements we have $2^{7-1}$=64 ordering possible.
P.S.- as we have 3 elements so for 1st pivot we have 2 choices next one we have 2 choices and the last one will be included automatically so in similar way for n distinct elements we have 2*2*2*2...........(n-1)times orderings