Consider an array consisting of ve and +ve numbers. What would be the worst time comparisons an algorithm can take in order to segregate the numbers having same sign altogether i.E all +ve on one side and then a
Answers
Answered by
1
Answer:
Here we can use the partition algorithm of quick sort for segregation and answer will be O(N).
Choose the first element as pivot whatever may be its sign we don’t care and keep an extra index at pivot position.
...
Similar questions
English,
6 months ago
Business Studies,
6 months ago
Computer Science,
11 months ago
Chemistry,
11 months ago
Math,
1 year ago