CODES

some learning from problems.

CODES

some learning from problems.

Showing posts with label Sorting. Show all posts
Showing posts with label Sorting. Show all posts
Friday, 14 September 2012

Sort an Array of 0 1& 2 in one pass

›
 G iven an array  int a[] = {0, 1, 1 ,0, 2, 2, 1, 0 ,1, 2, 1,0 } to be converted into  {0, 0, 0, 0, 1, 1, 1, 1, 1 ,2 ,2 ,2} inplace a...
Wednesday, 4 July 2012

sort an array a[n] containing 0s and 1s with time complexity n and you cant use more than 1 data structure

›
// TIME: O(n) || Space : O(1) #include<stdio.h> int main() { int A[20],i,j,n,temp; printf("Enter n :"...
›
Home
View web version
Powered by Blogger.
Powered by Blogger.