Skip to content
Related Articles
Open in App
Not now

Related Articles

GATE | GATE CS 1999 | Question 13

Improve Article
Save Article
Like Article
  • Last Updated : 12 Sep, 2018
Improve Article
Save Article
Like Article

Suppose we want to arrange the ii numbers stored in an array such that all negative values occur before all positive ones. Minimum number of exchanges required in the worst case is:
(A) n-1
(B) n
(C) n+1
(D) None of the above


Answer: (D)

Explanation: When we have ‘i’ numbers stored in an array, we have to swap all positive numbers with negative and in worst case positive numbers will be i/2.

Quiz of this Question

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!