# Thread: Analyzing time complexity of my code

1. ## Analyzing time complexity of my code

Hi guys, I'm just wondering when we are neglecting time complexity of something and when not? to clear more about an example, lets say I have a merge_sort recursively, when calling in this pattern Merge_Sort(Array A, q+p, r) which q is median and p,r are bounds of the array .. we are neglecting the consume time of argument q+p while adding .. why?! and when we are neglecting like these things and when not ?

2. Post your code.

3. I think you might benefit from reading some structured material on time complexity that would explain this to you.

4. Originally Posted by Salem
As you wish;
Code:
```Merge_Sort(A ,p, r)
{
if (p<r)
q=(r+p)/2;
Merge_Sort(A,p,q);
Merge_Sort(A,q+1,r);
Merge(A,p,q,r) // thats function is merging two arrays of size n
}```
How could I analyze the time complexity? I don't know which code's rows can be neglected and which not in calculating the time complexity ... thank in advance

5. Originally Posted by laserlight
I think you might benefit from reading some structured material on time complexity that would explain this to you.
Hi laserlight, I already have read the idea of time complexity but I'm not understanding when we can neglect time rather than the other time and vise versa ... as a result I posted here my thread in a hope to help!

thanks

6. Time complexity is a property ascribed to algorithms, not implementations.

Merge sort is Ο(n log n) regardless of how it is implemented.

Popular pages Recent additions