1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

wtf is wrong with this code????

Discussion in 'C' started by chetan3191, Dec 14, 2011.

Thread Status:
Not open for further replies.
  1. chetan3191

    chetan3191 New Member

    Joined:
    Dec 13, 2011
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    #include<stdio.h> void quick(int[],int); main(){ int a[]={11,2,5,4,7,3}; int len=sizeof(a)/sizeof(a[0]); quick(a,len); int i=0; while(i<len){ printf("%d,",a); i++; } } void quick(int a[],int len){ int pivot=a[0]; int loc=0; int i=0,j=len-1; while(i!=j){ while(j>=0 && i!=j ){ if(a[j]<pivot){ printf("asdasdad"); a[loc]=a[j]; loc=j; break; } j--; } while(a<len && i!=j){ if(a>pivot){ a[loc]=a; loc=i; break; } i++; } } a=pivot; }




    copy this code in ur compiler and try out..... it does not work for the given array of numbers......it a quick sort implementation for the first recursive step.....recursion is pending...i will do it later....but this problem has to be sorted out first.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
Thread Status:
Not open for further replies.

Share This Page