Hashtable

Discussion in 'C' started by clocking, Sep 30, 2007.

  1. clocking

    clocking New Member

    Joined:
    Jun 12, 2007
    Messages:
    122
    Likes Received:
    0
    Trophy Points:
    0
    Hi! guys
    Can you tell me about hashtable in C++. And Show me interupter in C. Thanks so much. :)
     
  2. clocking

    clocking New Member

    Joined:
    Jun 12, 2007
    Messages:
    122
    Likes Received:
    0
    Trophy Points:
    0
    So, I have a code :
    Code:
    int B(int m,int i){
      if (m/2 ==0)&&(m>2) {
        if (i < m-1) B = i;
        else B = m-2;
      else B = m-1;
    }
    void swap (int *i, int *j){
      int k;
      k = *i;
      *i = * j;
      *j = k;
    }
    void changepos(int m){
      if (m == 1) 
       for (int k = 1;k <= n ;k++){
         printf("%4d",P[k]);
      }
      else 
       for (int i = 1;i <= m; i++){
         changepos(m-1);
         if (i< m) swap(P[B(m,i)], P[m]);
        }
    }
    main(){
     int n, i, P[];
     printf(" input n: "); scanf("%d", &n);
     printf(" input P array: );
     for (i= 1;i<= n;i++)
     { printf("a[%d]= "<i);
       printf("%d",&P[i]);
     }
      for (i = 1;i <= n; i++)
      changepos(n);
    }
    
    I perform creating permutbility of P array.
    Show me the wrong code.
    thanks.
     
    Last edited by a moderator: Sep 30, 2007

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice