/*
*Copyright (c) 2015 烟台大学计算机与控制工程学院
*All right reserved.
*标题:数据结构实践——英文单词的基数排序
*作者:杨珺
*date:2015年12月14日
*版本:V1.0.1
*操作系统:XP
*运行环境:VC6.0
*问题描述:设计一个基数排序的算法,将一组英文单词,按字典顺序排列。
假设单词均由小写字母或空格构成,最长的单词有MaxLen个字母。
*/
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#define MaxLen 9 //单词的最大长度
#define Radix 27 //基数rd为27,分别对应' ','a',…'z'
typedef char String[MaxLen+1]; //定义String为字符数组类型
typedef struct node
{
String word;
struct node *next;
} LinkNode;
void DispWord(String R[],int n) //输出单词
{
int i;
printf(" ");
for (i=0; i<n; i++)
printf("[%s] ",R[i]);
printf("\n");
}
void PreProcess(String R[],int n)
//对单词进行预处理,用空格填充尾部至MaxLen长
{
int i,j;
for (i=0; i<n; i++)