What is the recurrence relation of the above algorithm? a step-by-step walkthrough would be appreciated.
Asked
Active
Viewed 203 times
-2
-
That's incomplete information to give a recurrence relation. What are x.c? – Mayur Kulkarni Dec 18 '15 at 07:12
-
x.n = number of keys in node ; x.key = value of key ; x.leaf = boolean(true if leaf) ; x.c = child node ; – panther1 Dec 18 '15 at 07:20
1 Answers
0
Your algorithm comprise for following steps :
- Initially it makes a linear search for the key, since it searches for all the elements it will add a complexity of -----> theta(n)
- If it finds the key, it returns
- Else, it recurses by passing it's child ------> T(child)
So, overall complexity : T(n) = T(n+1) + theta(n) ,
where T(n+1) will be the complexity for child node

Mayur Kulkarni
- 1,306
- 10
- 28