2008年广东北电面试题
pTemp?=?pTemp->next;}if?(curPos?!=?removenode)//?节点未寻到,错误退出{?return?false;}LNode?*pDel?=?NULL;?//?删除节点pDel?=?pTemp->next;pTemp->next?=?pDel->next;delete?pDel;m_listLength--;return?true;}
//sort the linked list to descending order.
void?LinkList::sort(){if?(m_listLength<=1){?return;}LNode?*pTemp?=?m_pList;int?temp;//?选择法排序for(int?i=0;i前两个函数实现了要求a,后一个函数sort()实现了要求b3. Debugging (Mandatory)a. For each of the following recursive methods, enter Y in the answer box if the method terminaters (assume i=5), Otherwise enter N.(题目意思:判断下面的递归函数是否可以结束)
static?int?f(int?i){?return?f(i-1)*f(i-1);}
Ansewr: N,明显没有返回条件语句,无限递归了
static?int?f(int?i){?if(i==0){return?1;}?else?{return?f(i-1)*f(i-1);}}
Ansewr:Y,当i=0时可结束递归
static?int?f(int?i){if(
……………………