freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

c語言面試大全1-資料下載頁

2025-05-13 18:48本頁面
  

【正文】 1 = head1next。p2 = head2 。}else{head = head2 。p2 = head2next 。p1 = head1 。}Node *pcurrent = head 。while ( p1 != NULL amp。amp。 p2 != NULL){if ( p1data = p2data ){pcurrentnext = p1 。pcurrent = p1 。p1 = p1next 。}else{pcurrentnext = p2 。pcurrent = p2 。p2 = p2next 。}}if ( p1 != NULL )pcurrentnext = p1 。if ( p2 != NULL )pcurrentnext = p2 。return head 。}(3)已知兩個鏈表head1 和head2 各自有序,請把它們合并成一個鏈表依然有序,這次要求用遞歸方法進(jìn)行。 (Autodesk)答案:Node * MergeRecursive(Node *head1 , Node *head2){if ( head1 == NULL )return head2 。if ( head2 == NULL)return head1 。Node *head = NULL 。if ( head1data head2data ){head = head1 。headnext = MergeRecursive(head1next,head2)。}else{head = head2 。headnext = MergeRecursive(head1,head2next)。}return head 。}41. 分析一下這段程序的輸出 (Autodesk)class B{public:B(){coutdefault constructorendl。}~B(){coutdestructedendl。}B(int i):data(i) //B(int) works as a converter ( int instance of B){coutconstructed by parameter data endl。}private:int data。}。B Play( B b) {return b 。}(1) results:int main(int argc, char* argv[]) constructed by parameter 5{ destructed B(5)形參析構(gòu)B t1 = Play(5)。 B t2 = Play(t1)。   destructed t1形參析構(gòu)return 0。               destructed t2 注意順序!} destructed t1(2) results:int main(int argc, char* argv[]) constructed by parameter 5{ destructed B(5)形參析構(gòu)B t1 = Play(5)。 B t2 = Play(10)。   constructed by parameter 10return 0。               destructed B(10)形參析構(gòu)} destructed t2 注意順序! destructed t142. 寫一個函數(shù)找出一個整數(shù)數(shù)組中,第二大的數(shù) (microsoft)答案:const int MINNUMBER = 32767 。int find_sec_max( int data[] , int count){int maxnumber = data[0] 。int sec_max = MINNUMBER 。for ( int i = 1 。 i count 。 i++){if ( data[i] maxnumber ){sec_max = maxnumber 。maxnumber = data[i] 。}else{if ( data[i] sec_max )sec_max = data[i] 。}}return sec_max 。}43. 寫一個在一個字符串(n)中尋找一個子串(m)第一個位置的函數(shù)。KMP算法效率最好,時間復(fù)雜度是O(n+m)。44. 多重繼承的內(nèi)存分配問題: 比如有class A : public class B, public class C {} 那么A的內(nèi)存結(jié)構(gòu)大致是怎么樣的?這個是pilerdependent的, 不同的實現(xiàn)其細(xì)節(jié)可能不同。如果不考慮有虛函數(shù)、虛繼承的話就相當(dāng)簡單;否則的話,相當(dāng)復(fù)雜??梢詤⒖肌渡钊胩剿鰿++對象模型》,或者:45. 如何判斷一個單鏈表是有環(huán)的?(注意不能用標(biāo)志位,最多只能用兩個額外指針) struct node { char val。 node* next。} bool check(const node* head) {} //return false : 無環(huán);true: 有環(huán)一種O(n)的辦法就是(搞兩個指針,一個每次遞增一步,一個每次遞增兩步,如果有環(huán)的話兩者必然重合,反之亦然):bool check(const node* head){ if(head==NULL) return false。 node *low=head, *fast=headnext。 while(fast!=NULL amp。amp。 fastnext!=NULL) { low=lownext。 fast=fastnextnext。 if(low==fast) return true。 } return false。}21 /
點擊復(fù)制文檔內(nèi)容
規(guī)章制度相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1