数据结构课程设计总结

《数据结构》 课程设计报告

数据结构课程设计总结

计算机与信息工程系

《数据结构》课程设计评阅表

数据结构课程设计总结

(小标题为宋体小四号字加粗)

正文为宋体五号字,行间距为22磅。

一、引言

从数据结构的意义、此项目的意义等多方面抽象阐述;

二、设计过程

课程设计的主要研究内容

1.设每个记录有下列数据项:电话号码、用户名、地址;

2.从键盘输入各记录,分别以电话号码和用户名为关键字建立散列表;

3.采用一定的方法解决冲突;

4.查找并显示给定电话号码的记录;

5.查找并显示给定用户名的记录。

数据结构和功能设计

数据结构课程设计总结

数据结构课程设计总结

? 哈希函数1

? 哈希函数2

? 输入函数

? 添加节点函数

? 新建节点函数1

? 新建节点函数2

? 显示列表函数1

? 显示列表函数2

? 查找用户信息函数

? 保存用户信息函数

? 菜单函数

程序主要结构

流程的名称解释如下

main()是主函数,负责调用其他所有的函数, hash1()号码哈希函数,hash2()名字哈希函数, node* input()函数用于输入节点,

apend()函数用于添加节点,

creat()函数用于新建电话号码节点,

creat2()函数用于新建名字节点,

list()用于显示按电话号码排列的列表,

list2()用于显示按姓名排列的列表,

find()按号码查询,

infd()按姓名查询,

save()保存用户信息,

menu()是菜单函数。

三、测试及运行结果

列清测试过程中常见的错误,及其解决办法

通过抓图加文字描述的方法写出运行过程及其结果 主菜单

数据结构课程设计总结

添加记录

数据结构课程设计总结

保存记录

数据结构课程设计总结

查找记录

数据结构课程设计总结

散列查看

数据结构课程设计总结

四、总结

总结对于数据结构课程的学习、对于课程的设计,自己所得以及不足,今后努力方向等 不少于1000字

通过这次课程设计,我有很深的体会,具体如下:

巩固和加深了对数据结构的理解,提高综合运用本课程所学知识的能力。

通过实际编译系统的分析设计、编程调试,掌握应用软件的分析方法和工程设计方法。

通过这次课程设计,我加深了对散列表的概念的理解,并能够熟练地将它们运用到实际操作中。 了解了查找、排序的时间复杂度、空间复杂度,能够在实际情况中根据要求选择出最适合。

五、参考文献

【1】****书籍,出版社,主编,出版日期等

【2】 百度网

六、附录

#include "iostream.h"

#include "string.h"

#include "fstream"

#define NULL 0

unsigned int key;

unsigned int key2;

int *p;

struct node //建节点

{

char name[8],address[20];

char num[11];

node * next;

};

typedef node* pnode;

typedef node* mingzi;

node **phone;

node **nam;

node *a;

using namespace std; //使用名称空间

void hash(char num[11]) //哈希函数

{

int i = 3;

key=(int)num[2];

while(num[i]!=NULL)

{

key+=(int)num[i];

i++;

}

key=key%20;

}

void hash2(char name[8]) //哈希函数 {

int i = 1;

key2=(int)name[0];

while(name[i]!=NULL)

{

key2+=(int)name[i];

i++;

}

key2=key2%20;

}

node* input() //输入节点

{

node *temp;

temp = new node;

temp->next=NULL;

cout<<"输入姓名:"<<endl; cin>>temp->name;

cout<<"输入地址:"<<endl; cin>>temp->address;

cout<<"输入电话:"<<endl; cin>>temp->num;

return temp;

}

int apend() //添加节点

{

node *newphone;

node *newname;

newphone=input();

newname=newphone;

newphone->next=NULL;

newname->next=NULL;

hash(newphone->num);

hash2(newname->name);

newphone->next = phone[key]->next; phone[key]->next=newphone;

newname->next = nam[key2]->next; nam[key2]->next=newname; return 0;

}

void create() //新建节点

{

int i;

phone=new pnode[20];

for(i=0;i<20;i++)

{

phone[i]=new node;

phone[i]->next=NULL;

}

}

void create2() //新建节点

{

int i;

nam=new mingzi[20];

for(i=0;i<20;i++)

{

nam[i]=new node;

nam[i]->next=NULL;

}

}

void list() //显示列表

{

int i;

node *p;

for(i=0;i<20;i++)

{

p=phone[i]->next;

while(p)

{

cout<<p->name<<'_'<<p->address<<'_'<<p->num<<endl; p=p->next;

}

}

}

void list2() //显示列表

{

int i;

node *p;

for(i=0;i<20;i++)

{

p=nam[i]->next;

while(p)

{

cout<<p->name<<'_'<<p->address<<'_'<<p->num<<endl; p=p->next;

}

}

}

void find(char num[11]) //查找用户信息

{

hash(num);

node *q=phone[key]->next;

while(q!= NULL)

{

if(strcmp(num,q->num)==0)

break;

q=q->next;

}

if(q)

cout<<q->name<<"_" <<q->address<<"_"<<q->num<<endl; else cout<<"无此记录"<<endl;

}

void find2(char name[8]) //查找用户信息

{

hash2(name);

node *q=nam[key2]->next;

while(q!= NULL)

{

if(strcmp(name,q->name)==0)

break;

q=q->next;

}

if(q)

cout<<q->name<<"_" <<q->address<<"_"<<q->num<<endl; else cout<<"无此记录"<<endl;

}

void save() //保存用户信息

{

int i;

node *p;

for(i=0;i<20;i++)

{

p=phone[i]->next;

while(p)

{

fstream iiout("out.txt", ios::out);

iiout<<p->name<<"_"<<p->address<<"_"<<p->num<<endl; p=p->next;

}

}

}

void menu() //菜单

{

cout<<"1.添加记录"<<endl;

cout<<"2.查找记录"<<endl;

cout<<"3.姓名散列"<<endl;

cout<<"4.号码散列"<<endl;

cout<<"5.清空记录"<<endl;

cout<<"6.保存记录"<<endl;

cout<<"7.退出系统"<<endl;

}

int main()

{

char num[11];

char name[8];

create();

create2() ;

int sel;

while(1)

{

menu();

cin>>sel;

if(sel==2)

{ cout<<"9号码查询,8姓名查询"<<endl; int b;

cin>>b;

if(b==9)

{ cout<<"请输入电话号码:"<<endl; cin >>num;

cout<<"输出查找的信息:"<<endl; find(num);

}

else

{ cout<<"请输入姓名:"<<endl;

cin >>name;

cout<<"输出查找的信息:"<<endl; find2(name);}

}

if(sel==3)

{ cout<<"姓名散列结果:"<<endl; list2();

}

if(sel==1)

{ cout<<"请输入要添加的内容:"<<endl; apend();

}

if(sel==4)

{ cout<<"号码散列结果:"<<endl;

list();

}

if(sel==5)

{ cout<<"列表已清空:"<<endl; create();

create2();

}

if(sel==6)

{ cout<<"通信录已保存:"<<endl; save();

}

if(sel==7) return 0;

}

return 0;

}

 

第二篇:数据结构课程设计总结(模板)

《数据结构》 课程设计报告

题 目: 班 级: 姓 名: 学 号: 指导教师: 刘 延 岭 日 期: 20xx年 1月8日

一、课程设计目标

数据结构课程设计总结模板

二、概要设计

数据结构课程设计总结模板

数据结构课程设计总结模板

三、详细设计

数据结构课程设计总结模板

数据结构课程设计总结模板

四、程序清单

数据结构课程设计总结模板

五、程序测试与运行结果

数据结构课程设计总结模板

六、课程设计总结

数据结构课程设计总结模板

七、成绩评定

数据结构课程设计总结模板

格式要求:A4纸打印,左右页边距2.5cm。表格中正文文字均为宋体小四号字,表格中的标题加粗,行间距20磅。左侧装订。图、表格要有编号和标题。程序清单采用Times New Roman字体,五号字。

相关推荐