当前位置:网站首页>Sequence table lookup

Sequence table lookup

2022-06-23 04:12:00 @Landscape post yuan

In order to find

int Sequential_Search ( int *a, int n, int key ) {
 int i;
 for (i = 1; i <= n; i++) {
     if (a[i] == key )
     return i;
   }
     return 0;
 }
int Sequential_Search2 ( int *a, int n, int key ) {
 int i;
 /*  set up   Set up  a[0]  by   Turn off   key   word   value  ,  I   People   call   And   by  “  whistle   The soldiers  ” */
 a[0] = key ;
 /*  Follow   Ring   from   Count   Group   tail   Ministry   open   beginning  */
 i = n;
 while (a[i] != key ) {
 i - -;
 }
 /*  return   return  0  be   say   bright   check   look for   loss   Defeat  */
 return i;
 }
原网站

版权声明
本文为[@Landscape post yuan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/174/202206222235486238.html