1 / 9
文档名称:

微软面试100题及答案.docx

格式:docx   大小:23KB   页数:9页
下载后只包含 1 个 DOCX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

微软面试100题及答案.docx

上传人:dlmus2 2022/5/7 文件大小:23 KB

下载得到文件列表

微软面试100题及答案.docx

相关文档

文档介绍

文档介绍:微软面试100题及答案
【篇一:微软技术面试100题答案1】
pclass=txt>(树)题目:
输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表。
要求不能创建任何新的结点,只调整指针deinlist=null;convertnode(pheadoftree,plastnodeinlist);//gettheheadofthedouble-linkedlistbstreenode*pheadoflist=plastnodeinlist;while(pheadoflistpheadoflist-m_pleft)pheadoflist=pheadoflist-m_pleft;returnpheadoflist;}但显然,以下这种思路更容易理解些:viewplaincopytoclipboard??
??
??
??
??
??
??
??
??
??
??
??
??
??
??
??bstreenode*convertnode(bstreenode*pnode,boolasright)(if(!pnode)returnnull;bstreenode*pleft=null;bstreenode*pright=null;//converttheleftsub-treeif(pnode-m_pleft)pleft=convertnode(pnode-m_pleft,false);//connectthegreatestnodeintheleftsub-tree
tothecurrentnodeif(pleft){pleft-m_pright=pnode;???????????????????????????????????????????????????????????????????????
???}//converttherightsub-treeif(pnode-m_pright)pright=convertnode(pnode-m_pright,true);//connecttheleastnodeintherightsub-treetothecurrentnodeif(pright){pnode-m_pright=pright;pright-m_pleft=pnode;}bstreenode*ptemp=pnode;//ifthecurrentnodeistherightchildofitsparent,//returntheleastnodeinthetreewhoserootisthecurrentnodeif(asright){while(ptemp-m_pleft)ptemp=ptemp-m_pleft;}//ifthecurrentnodeistheleftchildofitsparent,//returnthegreatestnodeinthetreewhoserootisthecurrentnodeelse{while(ptemp-m_pright)ptemp=ptemp-m_pright;}【篇三:微软面试100息】
ss=txt>题目:
输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表。要求不能创建任何新的结点,只调整指针的指向