Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Hashtable (http://www.go4expert.com/forums/hashtable-t6622/)

clocking 30Sep2007 14:10

Hashtable
 
Hi! guys
Can you tell me about hashtable in C++. And Show me interupter in C. Thanks so much. :)

clocking 30Sep2007 14:25

Re: Hashtable
 
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.


All times are GMT +5.5. The time now is 11:38.