当前位置:七七学习网文档大全求职指南求职笔试面试笔试题目C/C++ 笔试、面试题目大汇总» 正文

C/C++ 笔试、面试题目大汇总

[10-10 21:21:19]   来源:http://www.77xue.com  笔试题目   阅读:8595
概要:pcurrent->next = p1 ;pcurrent = p1 ;p1 = p1->next ;}else{pcurrent->next = p2 ;pcurrent = p2 ;p2 = p2->next ;}}if ( p1 != NULL )pcurrent->next = p1 ;if ( p2 != NULL )pcurrent->next = p2 ;return head ;}(3)已知两个链表head1 和head2 各自有序,请把它们合并成一个链表依然有序,这次要求用递归方法进行。 (Autodesk)答案:Node * MergeRecursive(Node *head1 , Node *head2){if ( head1 == NULL )return head2 ;if ( head2 == NULL)return head1 ;Node *head = NULL ;if ( head1->data < hea
C/C++ 笔试、面试题目大汇总,标签:驾照笔试题目,腾讯笔试题目,http://www.77xue.com
pcurrent->next = p1 ;

pcurrent = p1 ;

p1 = p1->next ;

}

else

{

pcurrent->next = p2 ;

pcurrent = p2 ;

p2 = p2->next ;

}

}

if ( p1 != NULL )

pcurrent->next = p1 ;

if ( p2 != NULL )

pcurrent->next = p2 ;

return head ;

}

(3)已知两个链表head1 和head2 各自有序,请把它们合并成一个链表依然有序,这次要求用递归方法进行。 (Autodesk)

答案:

Node * MergeRecursive(Node *head1 , Node *head2)

{

if ( head1 == NULL )

return head2 ;

if ( head2 == NULL)

return head1 ;

Node *head = NULL ;

if ( head1->data < head2->data )

{

head = head1 ;

head->next = MergeRecursive(head1->next,head2);

}

else

{

head = head2 ;

head->next = MergeRecursive(head1,head2->next);

}

return head ;

}

41. 分析一下这段程序的输出 (Autodesk)

class B

{

public:

B()

{

cout<<"default constructor"<<endl;

}

~B()

{

cout<<"destructed"<<endl;

}

B(int i):data(i)    //B(int) works as a converter ( int -> instance of B)

{

cout<<"constructed by parameter " << data <<endl;

}

private:

int data;

};

B Play( B b)

{

return b ;

}

(1)                                            results:

上一页  [1] [2] [3] [4] [5] [6] [7]  下一页


Tag:笔试题目驾照笔试题目,腾讯笔试题目求职指南 - 求职笔试面试 - 笔试题目
联系我们 | 网站地图 | 范文大全 | 管理知识 | 教学教育 | 作文大全 | 语句好词
Copyright http://www.77xue.com--(七七学习网) All Right Reserved.
1 2 3 4 5 6 7 8 9 10