问题及代码:
代码:
/*
* Copyright (c)2016,烟台大学计算机与控制工程学院
* All rights reserved.
* 文件名称:项目4.cpp
* 作 者:孙子晴
* 完成日期:2016年12月18日
* 版 本 号: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