问题及代码:
/*
* Copyright(c) 2017,烟台大学计算机学院
* All rights reserved.
* 文件名称:cpp1.
* 作 者:薛瑞琪
* 完成日期:2017 年 12 月 13 日
* 版 本 号:v1.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&