863 views
0 votes
0 votes
every time while finding recurence solution (in CLRS book , page 88)  a statement "Floors and ceilings usually do not matter when solving recurrences" but my doubt is when they matter ?

2 Answers

Best answer
2 votes
2 votes
Whenever we need to find exact recurrence expression then floor and celing matters.. otherwise it is useless because one or two, in general constant people doesn't affect time Complexity..

Let , (n/2) and n is odd then we can take value as Floor (n/2) or Ceil (n/2).. difference between floor and ceil value is one .. here n is no of input.. one less or one more input doesn't affect asymptotic complexity..

 

But whenever we need to find something like exact no of comparison then we need floor ceil  precisely..
selected by
0 votes
0 votes
floor and ceiling values matters when the no. of element is odd.

in sorting algo ... lets say merge sort ,for finding the middle element of the entire array

better check the algo .. of merge sort  u will get cleared

Related questions

0 votes
0 votes
1 answer
2
shashi111 asked Aug 27, 2017
522 views
Consider the following recurrence.T(n) = T() + What is the value of recurrence?please explain in detail
0 votes
0 votes
1 answer
3
Hardik1997 asked May 20, 2017
358 views
1 :- T(n) = T(n-2) + n22 :- T(n) = 4T(n/3) + nlgn3 :- T(n) = 3T(n/3 - 2) + n/2
2 votes
2 votes
2 answers
4
Regina Phalange asked Mar 4, 2017
2,998 views
What is the value of following recurrence.T(n) = T(n/4) + T(n/2) + cn^2 T(1) = c T(0) = 0Where c is a positive constantA) O(n^3)B) O(n^2)C) O(n^2logn)D) O(nlogn)