480 views
0 votes
0 votes
T(n)=aT(n/b) +f(n) here f(n) is the cost of conquering the sub-problems i.e. cost of merging
all the sub-problems in order to solve the problem but in case of partioning we are dividng the array around
a particular pivot point so while calcualting the time complexity of quick-sort why do we take O(n)
time for f(n) ,how is acting as a conquering step?

2 Answers

Best answer
3 votes
3 votes

Here , conquering cost is  O(1)

and partition algo { O(n) } is the cost for dividing the big problem into small sub-problems.

So,    T(n) =       O(n)            +              T(k * n )  +   T( (1-k)* n )            +             O(1)

                     Divide cost                 Sub-problems' cost                  Combine-Cost


Note: f(n) as u described is Divide + Conquer cost  , not just conquer. 

selected by

Related questions

0 votes
0 votes
1 answer
1
sh!va asked Jul 13, 2016
5,888 views
A desirable choice for the partitioning element in quick sort is(A) First element of the list(B) Last element of the list(C) Randomly chosen element of the list(D) Median...
0 votes
0 votes
2 answers
2
radha gogia asked Jul 29, 2015
602 views
when I write this statement int i=1,2,3 then why is this an error , how does comma acts here as a separator ,while in this casei=1,2,3 it acts an operator
3 votes
3 votes
2 answers
3
0 votes
0 votes
1 answer
4