• <sub id="h4knl"><ol id="h4knl"></ol></sub>
    <sup id="h4knl"></sup>
      <sub id="h4knl"></sub>

      <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
      1. <strong id="h4knl"></strong>

      2. sony筆試題

        時間:2024-10-16 18:51:48 面試筆試 我要投稿
        • 相關(guān)推薦

        sony筆試題

          1. include

        sony筆試題

          define n 8

          int main()

          {

          int i;

          int j;

          int k;

          (填寫) return 0;} 答:

          本帖隱藏的內(nèi)容需要回復(fù)才可以瀏覽
          2.完成程序,實(shí)現(xiàn)對數(shù)組的降序排序

          include

          void sort( );

          int main()

          { int array[]={45,56,76,234,1,34,23,2,3}; //數(shù)字任意給出

          sort( );

          return 0;

          }

          void sort( )

          {

          │ │

          │ │

          │ │

          }

          答:使用選擇排序法,我為sort函數(shù)多加了兩個形參,至少第一個是必須的,否則無法傳入待排序數(shù)組。不知道這樣做是否符合題意。

          void sort(int *array,int num)

          {

          int temp;

          for(int i=0;i

          for(int j=i+1;j

          if (array

          {

          temp=array;

          array=array[j];

          array[j]=temp;

          }

          }

          3.費(fèi)波那其數(shù)列,1,1,2,3,5……編寫程序求第十項(xiàng)。可以用遞歸,也可以用其他方法,但要說明你選擇的理由。

          include

          int pheponatch(int);

          int main()

          {

          printf("the 10th is %d",pheponatch(10));

          return 0;

          }

          int pheponatch(int n)

          {

          │ │

          │ │

          }

          答:使用遞歸,理由是遞歸編程簡單,代碼容易理解,但缺點(diǎn)是效率不高,而且有深度限制,如果深度太深,則堆棧會溢出。

          int pheponatch(int n)

          {

          if (n3)

          return 2;

          else if (n2||n1)

          return 1;

          else

          return pheponatch(n-1)+pheponatch(n-2);

          }

          4.下列程序運(yùn)行時會崩潰,請找出錯誤并改正,并且說明原因。

          include

          include

          typedef struct tnode

          {

          tnode* left;

          tnode* right;

          int value;

          }tnode;

          tnode* root=null;

          void append(int n);

          int main()

          {

          append(63);

          append(45);

          append(32);

          append(77);

          append(96);

          append(21);

          append(17); // again, 數(shù)字任意給出

          return 0;

          }

          void append(int n)

          {

          tnode* newnode=(tnode *)malloc(sizeof(tnode));

          newnode->value=n;

          newnode->left=null; //新增

          newnode->right=null; //新增

          if(rootnull)

          {

          root=newnode;

          return;

          }

          else

          {

          tnode* temp;

          temp=root;

          while((n>=temp->value && temp->left!=null)||(nvalue && temp->right!=null))

          {

          while(n>=temp->value && temp->left!=null)

          temp=temp->left;

          while(nvalue && temp->right!=null)

          temp=temp->right;

          }

          if(n>=temp->value)

          temp->left=newnode;

          else

          temp->right=newnode;

          return;

          }

          }

          答:因?yàn)樾鹿?jié)點(diǎn)的左右指針沒有賦null值,至使下面的while循環(huán)不能正確結(jié)束而導(dǎo)致內(nèi)存越界,最后崩潰(注意結(jié)束條件是temp->left!= null或temp->right!=null)。改正就是增加兩條賦值語句,如上文紅色部分字體就是新增的兩條語句。

        【sony筆試題】相關(guān)文章:

        SONY邏輯筆試題02-18

        sony 邏輯部分筆試題目分享11-21

        SONY 培訓(xùn)生一面02-23

        SONY 電子類筆試經(jīng)驗(yàn)分享11-21

        中國銀行筆試題回顧,新鮮筆經(jīng)!11-21

        迅雷JAVA廣州站二筆筆試題目分享11-21

        大唐移動測試工程師筆經(jīng),筆試題目分享11-21

        網(wǎng)易筆經(jīng)11-11

        奧美筆經(jīng)02-23

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码
      3. <sub id="h4knl"><ol id="h4knl"></ol></sub>
        <sup id="h4knl"></sup>
          <sub id="h4knl"></sub>

          <sub id="h4knl"><ol id="h4knl"><em id="h4knl"></em></ol></sub><s id="h4knl"></s>
          1. <strong id="h4knl"></strong>

          2. 亚洲一区国产美女在线 | 亚洲欧美日韩颜射在线 | 日韩小u女一区二区三区在线观看 | 亚洲AV日韩AV鸥美在线观看 | 视频二区中文字幕欧美 | 亚洲中文字幕aV女同在线 |