用二叉排序树实现的将乱序输入字母按从小到大排列,无重复输出项.
#include<stdio.h>
#include<stdlib.h>
#include<strings.h>
typedef struct node{
char data;
struct node *left;
struct node *right;
}node;
/*
* 中序遍历
*/
void print_node(node *p){
if(p){
print_node(p->left);
printf("%c",p->data);
print_node(p->right);
}
}
int main(void){
node *head;
char tmp;
node *p;
/*生成头节点*/
head=(node *)malloc(sizeof(node));
if (!h

本文通过一个实例展示了如何使用二叉排序树对无序输入的字母进行从小到大的排序,确保输出中没有重复项。
最低0.47元/天 解锁文章
1863

被折叠的 条评论
为什么被折叠?



