Hashtable

clocking's Avatar, Join Date: Jun 2007
Ambitious contributor
Hi! guys
Can you tell me about hashtable in C++. And Show me interupter in C. Thanks so much.
clocking's Avatar, Join Date: Jun 2007
Ambitious contributor
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 shabbir; 30Sep2007 at 18:27.. Reason: Code block