数据结构试验-线性表.doc

  1. 1、本文档共15页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
数据结构试验-线性表

实验目的和要求: 1.熟练掌握连表的实现, 2,编写出可执行的程序 内容和步骤: 1、 ? ?需求分析程序的功能; 2. ? ?输入输出的要求; 3. ? ?测试数据。 2、 ? ?概要设计本程序所用的抽象数据类型的定义;namespace h { /// 1 如果在链式线性表中加入统计功能,例如统计存储记录中姓氏的数量,请用C#完成这个功能; class Class1 { static void Main(string[] args) { stu824 l=new stu824() ; student A=new student (); A._name =李玮; A._ID =10; A.next=null; l.Append_stu824 (l,A); A._name =赵龙山; A._ID =10; A.next=null; l.Append_stu824 (l,A); A._name =潘天路; A._ID =10; A.next=null; l.Append_stu824 (l,A); A=l.get_value (l,1); string s; char[] a=new char [10]; A._name .CopyTo(0,a,0,1); Console.WriteLine ( {0},a[0] ); l.test_familyname (l); } } class student { //元素定义 private int ID private string name; public student next; public int _ID { get{return ID} set{ID=value;} } public string _name { get{return name;} set{name=value;} } public student() { ID=0; name=; next=null; } } class stu824 { student head =new student (); student tail=new student (); int lenth; public stu824() { head.next =tail; tail =head; lenth=0; } public int get_lenth(stu824 l) { return l.lenth ; } public student get_value(stu824 l,int n) { student stu=new student (); stu=l.head ; for(int i=0;in;i++) { if (stu!=null) stu=stu.next ; } return stu; } public bool Append_stu824(stu824 l,student A) { student stu=new student (); stu._ID =A._824; stu._name =A._name ; stu.next =null; l.tail.next=stu ; l.tail =stu ; l.lenth ++; return true; } public bool test_familyname(stu824 l) {//完成姓氏统计功能 student A=new student (); char[] s=new char [10]; int [] n=new int [10]; A=l.head .next ; int i=0,j=0,t=0; for(;il.lenth ;i++) { A._name .CopyTo (0,s,j ,1) ; for(t=0;t=j;t++) { if( s[t].Equals (s[j])) { n[t] ++; } else {

文档评论(0)

文档精品 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:6203200221000001

1亿VIP精品文档

相关文档