博文
顺序和二分查找(2005-07-04 12:53:00)
摘要:#include<stdio.h>
#include<stdlib.h>
#define N 10
typedef struct
{
int *elem;
int length;
}list;
list L;
int *head;
void initial_list()
{
L.length=N;
L.elem=NULL;
}
void create_list()
{
int i=0;
head=L.elem=(int *)malloc(N*sizeof(int));
if(!L.elem)
{
printf("overflow!");
exit(0);
}
printf("please input the sequential list(%d):\n",N);
while(i<N)
{
printf("\nthe %dth elem:",i+1);
scanf("%d",&(L.elem[ i ]));
i++;
}
getchar();
}
int issequential_list()
{
int i=0;
L.elem=head;
while(i<N-1)
{
if(L.elem[ &nbs......
学生成绩管理系统(2005-06-26 13:30:00)
摘要:/*第三方函数库: SGCHN3.0*/
/*该库函数的的一些函数说明
/* C Head File.
SGCHN30.h
Definitions for SGCHN3.0 Run time Library Function.
Copyright (c) 2004, 2005 SGPRO
All Rights Reserved.
Autor: YinShengge 作者: 殷圣鸽
Version: 3.0
Build Time: 2004 - 4
Maintain Time: 2005-5-14
Maintain Time: 2005-5-19
*/
extern void SGCHNinit();
extern char *getsgchnversion(); /*获得SGCHN版本*/
extern int scanformat(char *formats, ...); /*控制台格式输入 与scanf类似*/
extern int print(char *formats,...); /*控制台格式输出 与printf类似*/<......
学生信息管理系统(2005-06-26 13:28:00)
摘要:/*第三方函数库 SGCHN3.0*/
/*该函数库一些函数说明
/* C Head File.
SGCHN30.h
Definitions for SGCHN3.0 Run time Library Function.
Copyright (c) 2004, 2005 SGPRO
All Rights Reserved.
Autor: YinShengge 作者: 殷圣鸽
Version: 3.0
Build Time: 2004 - 4
Maintain Time: 2005-5-14
Maintain Time: 2005-5-19
*/
extern void SGCHNinit();
extern char *getsgchnversion(); /*获得SGCHN版本*/
extern int scanformat(char *formats, ...); /*控制台格式输入 与scanf类似*/
extern int print(char *formats,...); /*控制台格式输出 与printf类似*/......
哈希表创建伪随机处理冲突(2005-06-13 14:07:00)
摘要:#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define N 30
typedef char elemtype[19];
typedef struct node
{
elemtype name;
int num;
}tablenode;/*定义结点类型*/
tablenode *L;
void create_hash()/*伪随机法构造哈希表*/
{
int i,sum;
char string[19];
L=(tablenode *)malloc(N*sizeof(tablenode));
if(!L)
{
printf("\noverflow!");
exit(0);
}
for(i=0;i<N;i++)
{
L[i].name[0] ='\0';
L[i].num=i;
 ......
图的深度优先搜索和广度优先搜索(2005-05-27 10:14:00)
摘要:#include<stdio.h>
#include<stdlib.h>
#define Max_vertex 20
typedef int elemtype; /*最大顶点数*/
typedef struct QNode /* 队列元素类型*/
{
elemtype data;
struct QNode *next;
}QNode,*QNodeptr;
typedef struct QueueNode
{
QNodeptr front ;
QNodeptr rear;
}Queue; /*队列类型*/
Queue *L; /*建立队列*/
typedef enum
{
FALSE,
TRUE
}Boolean;
Boolean visited[Max_vertex];/*联合体类型数组*/
typedef char vertextype[Max_vertex];/*顶点类型*/
typedef struct edgenode
{
int adjvex;
struct edgenode *next;
}EdgeNode; /*边类型*/
typedef struct vertexnode
{
vertextype ve......
十字链表创建图(2005-05-25 13:49:00)
摘要:#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define Max 20
typedef char vertextype[Max];
typedef int InfoType;
typedef struct ArcBox
{
int tailvex,headvex;
struct ArcBox *hlink,*tlink;
InfoType info;
}ArcBox;
typedef struct vexnode
{
vertextype data;
ArcBox *firstin,*firstout;
}vexnode;
typedef struct
{
vexnode xlist[Max];
int vexnum,arcnum;
}OLGraph;
OLGraph G;
int LocateVex(OLGraph *H,vertextype c)
{
int i;
for(i=0;i<G.vexnum;i++)
{
if(strcmp(c,H->xlist[i].data))
return i;
}
return 0;
}
main()
{
vertextype a,b;
InfoType intout;
ArcBox *p;
int i,j,k;
printf("please input the number of vertex and arcnode,IncInfo(0 or 1):\n");
scanf("%d%d%d",&G.vexnum,&G.arcnum,&intout);
fflush(stdin);
printf("\n please i......
高级程序员考试心得 (2005-05-16 13:01:00)
摘要:
前些天发表了一篇《2002年系统分析员考试心得》,没想到十分受大家欢迎,收到了几十封网友的E-mail,这其中有许多朋友说自己觉得系统分析员级考试难度太大,还没有准备2003年考,但觉得高级程序员(软件设计师)级考试可能比较适合自己,还询问我2001年当时参加高级程序员考试时的心得。我想既然大家这么瞧得起我,我还是将当年的考试心得写出来,这样便可以全面系统介绍了我的考试心得,帮助大家顺利通过。虽然2001年至今已经过去了两年,两年的考试也会有些变化,但我想我的这些心得还是不会白写的,万变不离其踪。好吧,请各位仔细往下看吧:)
正文:
还是一样,我先简单介绍一下高级程序员考试,让大家有个大概的认识。高级程序员全称是“全国软件资格与水平考试——高级程序员级”,其大纲称“通过本级考试的合格人员能按照软件需求规格说明书进行软件设计和编制程序,具有相当于工程师的实际工作能力和业务水平”。记得前些年,这个级别改称“系统设计师”。我个人认为这种改变还是正确的,因为高级程序员在实际工作中和程序员(许多人称这个级别为中级程序员)还是有很大的区别的,程序员主要是带领初级程序员进行某一个系统中若干相关模块的开发,并负责将这部分合并提交,可以说程序员的主要工作是编码,工作还主要停留在技术层面。而高级程序员正像其改名后的称谓:系统设计师,其工作是辅助系统分析员进行软件系统中的功能设计,已经不仅仅是技术层面的工作了,还包括许多功能分析和设计的工作。因为我个人认为,由于软件资格与水平考试的这四个级别是十多年前定下的,今天已经不能适应现在软件开发的要求。我觉得应该改称:编码员、程序员、系统设计师、系统分析师。这么改也是符合现代软件开发中的惯例。
明白了高级程序员的工作后,我们就可以对自己面对的考试有一个清醒的认识。高级程序员考试不是考编程,而是考功能设计。这点对于复习来说是十分重要的。看看这些年的试题,上午主要是以基础知识考查为主,下午特别是以考功能设计为主。所以复习时要特别注意相关的能力的培养。在这篇文章中,我不想介绍具体知识和能力的提高,而是从方法上介绍我的心得,具体的知识解答等问题,可以看其他相关的文章。下面,我......
图的邻接表建立及深度优先搜索(2005-05-14 13:02:00)
摘要:#include<stdio.h>
#include<stdlib.h>
#define Max_vertex 20
typedef enum
{
FALSE,
TRUE
}Boolean;
Boolean visited[Max_vertex];
typedef char vertextype;
typedef struct edgenode
{
int adjvex;
struct edgenode *next;
}EdgeNode;
typedef struct vertexnode
{
vertextype vertex;
EdgeNode * firstedge;
}VertexNode;
typedef VertexNode AdjList[Max_vertex];
typedef struct ALGraph
{
AdjList adjlist;
int n,e;
}Graphic;
void createGraphic(Graphic *G)
{
int i,j,k;
EdgeNode *s;
printf("please input the vertexs' number and Edges' number:\n");
fflush(stdin);
scanf("%d%d",&G->n,&G->e);
getchar();
printf("please input the vertexs' information.\n");
for(i=1;i<(G->n+1);i++)
{
fflush(stdin);
G->adjlist[i].vertex=getchar();
G->adjlist[i].firstedge=NULL;
getchar();
}
printf("ple......
哈夫曼编码及解码(2005-05-11 14:19:00)
摘要:
统计文件中字符的次数,并且把他们当作权值,进行hufuman编码:
#include<stdio.h>
#include<stdlib.h>
#include<alloc.h>
#include<ctype.h>
#define swap(x,y,t) ((t)=(x),(x)=(y),(y)=(t))
#define N 26
char string[N]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
int num[N];
typedef struct
{
int weight;
int parent,lchild,rchild;
}HTnode,*hafumantree;
typedef char **hufumanode;
hafumantree HT;
hufumanode HC;
int small(int x)/*求最小权值*/
{
int i=0,flag,k=32767;
for(;i<=x;i++)
if(HT[i].weight<k&&HT[i].parent==0)
{
k=HT[i].weight;
flag=i;
}
HT[flag].parent=1;
return flag;
}
void select(int i,int *s1,int *s2)/*选择s1,s2,为最小的两个权值(s1<s2)*/
{
int temp;
*s1=small(i);
*s2=small(i);
if(*s1>*s2)
swap(*s1,*s2,temp);
}
void hufumancoding(int *w,int n)/*编译码*/
{
int m,i,s1,s2,f,c,s......
线性表的基本操作(2005-05-08 13:47:00)
摘要:#include<stdio.h>
#include<stdlib.h>
typedef struct
{
int data;
struct *next;
}node,*link;
link L;
int inital_linklist(link S)
{link head,new;
char ch;
int num=1;
head=NULL;
S=(node *)malloc(sizeof(node));
if(!S)
{
printf("overflow!");
exit(0);
}
S->next=head;
head=S;
printf("please input the data:\n");
scanf("%d",&head->data);
printf("continue?Y or N?\n");
scanf("%c",ch);
while(ch!='N'||'n')
{
new=(node *)malloc(sizeof(node));
if(!new)
{
printf("overflow!");
exit(0);
}
new->next=head;
head=new;
printf("please input the data:\n");
scanf("%d",&head->data);
num++;
printf("continue?Y or N?\n");
scanf("%c",ch);
}
printf("succeed in cr......