
计算机软件技术基础
文章平均质量分 70
spritsq
这个作者很懒,什么都没留下…
展开
-
第七章第19题关键代码
typedef struct{ char str[MAX]; int len;}seqstring;void MyDelete(seqstring* s,int i,int j){ int k,h; if(i+j-1>s->len) printf("OverFlow/n"); else { for(k=0;k for(h=0;hlen-(i+k+1);h++) s->str[i+原创 2006-04-09 23:00:00 · 886 阅读 · 1 评论 -
第11章第15题定义代码(h) (Powered by biggates)
/// Chapter11.h: 第11章数据结构 typedef int keyType; //以int类型作为散列值类型typedef char dataType; //以char类型作为数据类型 const int HASH_TABLE_LENGTH = 20;//令表长为20 const int原创 2006-06-12 16:01:00 · 691 阅读 · 0 评论 -
第11章第15题完整代码(cpp) (Powered by biggates)
/// 11_15.cpp: 编写对一组关键字,利用链地址法解决冲突,/// 散列函数为H(k),写出在此散列表中插入、删除元素的算法 #include "stdafx.h"#include #include #include #include #include "Chapter11.h" void printDataType(const dataTyp原创 2006-06-12 15:57:00 · 770 阅读 · 0 评论 -
第十章第十六题 POWERBY KTL
//16.利用图的深度优先搜索和广度优先搜索各写一个算法,//辨别以邻接表方式表示的有向图中是否存在由顶点Vi到顶点Vj的路径(i!=j).//深度优先(第一个函数Route)//广度优先(第二个函数Route,需要去调注释同时把深度优先函数注释掉;//程序输入,参考书本P225页图10-6//输入顶点信息为1234(回车);//输入边数为4;//输入第一边:1 2//输入第二边:1 3//输入第原创 2006-06-09 01:32:00 · 807 阅读 · 0 评论 -
第10章第16题定义(h) (Powered by biggates)
/// Chapter10.h: 第十章的结构定义和函数声明 const int NUM_OF_VEX = 8; //顶点数 //以下是邻接矩阵的定义typedef struct graphArray{ char vex[NUM_OF_VEX]; //顶点数组 int arcs[NUM_OF原创 2006-06-08 00:16:00 · 728 阅读 · 0 评论 -
第10章第16题完整代码(cpp) (Powered by biggates)
/// 10_16 利用图的深度优先搜索和广度优先搜索各写一个算法,/// 判别以邻接表方式表示的有向图中是否存在由顶点/// vi到顶点vj的路径(i!=j) #include "stdafx.h"#include #include #include #include #include "Chapter10.h" void initializeGr原创 2006-06-08 00:13:00 · 704 阅读 · 0 评论 -
第13题用线性探查法实现的散列表 POWERBY KTL
/*设有一组关键字(许炼2,35,124,153,84,57),需要插入到表长为12的散列表中。本程序把该题目编写为程序,输入72 35 124 153 84 57回车,输入查找的关键字,因为输出为key,而不是other,所以若输出与你输入的关键字相同则程序运行正确。*/#include "stdio.h"#include "stdlib.h"#define p 11#define M 12原创 2006-06-12 17:39:00 · 1868 阅读 · 0 评论 -
第九章17题power by spirit_only
// 9_17_main.cpp : 二叉树的非递归先序遍历//#include "stdafx.h"#include #include //数据结构定义及全局常量定义int const MAXSIZE = 50;typedef char datatype;struct node { datatype data; stru原创 2006-06-02 15:42:00 · 630 阅读 · 0 评论 -
第8章第16题的完整程序(Powered by biggates)
/// 8_16.cpp : 假设以数组sequ[m]存放循环队列的元素,同时设变量/// rear 和quelen 分别指示循环队列中队尾元素的位置和内含元素的个数。/// 试给出判别此循环队列的队满条件,并写出相应的入队列和出队列的算法。/// 说明:本程序之所以不用typedef 把char定义成datatype,是因为:/// 在C语言中没有输入输出的重构函数,所以即使原创 2006-05-26 16:28:00 · 1124 阅读 · 0 评论 -
第8章第11题的完整程序(Powered by biggates)
由于篇幅比较长,请访问http://spaces.msn.com/biggates/blog/cns!715707C35A631274!279.entry原创 2006-05-26 17:39:00 · 727 阅读 · 0 评论 -
第六章31题全部代码(powered by spirit_only)
1 // 2 //6_31字符分类 3 // 4 #include 5 #include 6 typedef char datatype; 7 typedef struct node 8 { 9 datatype data; 10 struct node *next; 1原创 2006-04-23 22:29:00 · 670 阅读 · 0 评论 -
第六章21全部代码(powered by spirit_only)
1 // 2 //6_21线性表逆置 3 // 4 #include 5 #include 6 typedef int datatype; //数据域中的数据类型 7 #define MAXSIZE 1024 8 #define LAST 50原创 2006-04-23 22:36:00 · 699 阅读 · 0 评论 -
第六章22题全部代码(powered by spirit_only)
1 //动态链表插值 2 #include 3 #include 4 #include 5 typedef int datatype; 6 typedef struct node 7 { 8 datatype data; 9 struct node *next; 10 }li原创 2006-04-23 22:33:00 · 604 阅读 · 0 评论 -
第七章20题关键代码
typedef struct linknode{ char data; struct linknode *pNext;}linkstring;void MyChange(linkstring * S,char c,char s){ while(S){ if(S->data==c) S->data=s; S=S->pNext; } return;}void display(linkstr原创 2006-04-09 23:03:00 · 633 阅读 · 0 评论 -
第七章26题关键代码
spmatrix *Chen(spmatrix *a,spmatrix *b){ int ano,bno,cno,col; spmatrix * c; c=InitSpmatrix(a->m,b->n,(a->m)*(b->n)); c->t=0; cno=0; for(col=0;coln;col++){ bno=0; for(ano=0;anot;ano++){ if(a->data[原创 2006-04-09 23:05:00 · 710 阅读 · 0 评论 -
第十五题用拉链法实现散列表 POWERBY KTL
/*15.编写对一组关键字,利用链地址法解决冲突,散列函数为H(k),写出在此散列表中插入、删除元素的算法。程序输入 参考书本p269 其中除留余数p为6 拉链长度M为6 关键字长度N为6输入72 35 124 153 84 57接着要求输入需要查找的关键字,本程序打印出来的是key而不是other,所以只要输出等于输入的关键字程序就正确了。*/#include "stdio.h"#include原创 2006-06-12 17:41:00 · 1940 阅读 · 0 评论