Advertisement
Meruem

inserimento di un'elemento in vettore ordinato

Jun 12th, 2015
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function ins_vett(v,x)
  2. {
  3.     var tmp;
  4.                v.push(x); cur=v.lenght;
  5.                     for(i=cur-1;i>=0;i--)
  6.                         {
  7.                             if(v[i]>v[cur]){ tmp=v[i];v[i]=v[cur];v[cur]=tmp; cur--;}
  8.                                 else{return v;}
  9.                         }
  10.                
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement