- 3
- 0
- 约1.29万字
- 约 36页
- 2017-03-28 发布于四川
- 举报
vc程序的的设计链表与链表的基本的的操作
templatetypename T NodeT* ListT::Find(T data){ NodeT *tempP=head-link; while(tempP!=NULLtempP-info!=data) tempP=tempP-link; return tempP; } //搜索成功返回该结点地址,不成功返回NULL templatetypename Tint ListT::Length( ){ NodeT* tempP=head-link; int count=0; while(tempP!=NULL){ tempP=tempP-link; count++;} return count; } Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. templatetypename Tvoid ListT::PrintList( ){ NodeT* tempP=head-link; while(tempP!=NULL){ couttempP-info\t; tempP=tempP-link; } coutendl; } templatetypename Tvoid ListT::InsertFront(NodeT *p){ p-link=head-link; head-link=p; if(tail==head) tail=p; } Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. templatetypename Tvoid ListT::InsertRear(NodeT *p){ p-link=tail-link; tail-link=p; tail=p; } templatetypename TNodeT* ListT::CreatNode(T data){ NodeT*tempP=new NodeT(data); return tempP; } Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. templatetypename Tvoid ListT::InsertOrder(NodeT *p){ NodeT *tempP=head-link, *tempQ=head; //tempQ指向tempP前面的一个结点 while(tempP!=NULL){ if(p-infotempP-info) break; //找第一个比插入结点大的结点,由tempP指向 tempQ=tempP; tempP=tempP-link; } tempQ-InsertAfter(p); //插在tempP指向结点之前,tempQ之后 if(tail==tempQ) tail=tempQ-link; } Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile 5.2.0.0. Copyright 2004-2011 Aspose Pty Ltd. templatetypename T NodeT* ListT::DeleteNode(NodeT* p){ NodeT* tempP=head; while(tempP-link!=NULLtempP-link!=p) tempP=tempP-link; if(tempP-link==tail) tail=tempP; return tempP-RemoveAfter( );
您可能关注的文档
最近下载
- 【基恩士】IG 系列 用户手册 (简体中文).pdf VIP
- 安徽财经大学《数值分析》2019-2020学年期末试卷.pdf VIP
- 《律师事务所退伙协议》.docx VIP
- SHS 01037—2019 球形储罐维护检修规程.docx VIP
- 文本教案半潜平台se23dec2012workshop binder.pdf VIP
- 《碳达峰碳中和政策法规汇编(2024年9月刊)》.pdf VIP
- 探索式软件测试方法在敏捷开发中的应用研究.docx VIP
- 中国行业标准 YY/T 1226-2022人乳头瘤病毒核酸(分型)检测试剂盒.pdf
- 延安市各区县地表水系图.pdf VIP
- 2025-2026学年一年级数学上册乐考非纸笔测试题(一)(人教版·新教材).docx VIP
原创力文档

文档评论(0)