Reputation: 3011
Please Also answer for:
Discuss Hoare partition algorithm used for portioning the array used in quick sort with suitable example.
Upvotes: 1
Views: 2643
Reputation: 731
depend on the way you implement quicksort.
depend on the pivot selecting strategy.
depend on the pivot selecting strategy.
right.
Upvotes: 0
Reputation: 18148
Please specify what your question is in the future.
You need to specify what pivot you're using - I'm guessing that you're always using the first partition element as the pivot in which case your answers for 2 and 3 are correct, but if you were using the middle partition element or a random partition element then your answer for 2 would be incorrect (the expected runtime would be n log n).
Your answer for 4 is incrrect - alpha needs to figure into your complexity analysis. If alpha = .5 then the complexity is n log n, but if alpha = 1/n then the complexity is n^2. You are probably supposed to provide the recurrence relation that you derived as well.
Upvotes: 2