C:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node
{
char data[30];
struct node *lc;
struct node *rc;
int num;
};
char a[30];
int n;
struct node *creat(struct node *root)
{
if(root == NULL)
{
root = (struct node *)malloc(sizeof(struct node));
root->lc = NULL;
root->rc = NULL;
root->num = 1;
strcpy(root->data, a);
}
else
{
if(strcmp(a, root->data) == 0)
{
root->num++;
}
else if(strcmp(a, root->data) < 0)
{
root->lc = creat(root->lc);
}
else
{
root->rc = creat(root->rc);
}
}
return root;
};
void fin(struct node *root)
{
if(root != NULL)
{
fin(root->lc);
printf("%s %.2lf%%\n", root->data, 1.0 * root->num * 100 / n);
fin(root->rc);
}
}
int main()
{
int i, j;
int len;
struct node *root;
scanf("%d ", &n);
root = NULL;
for(i = 0; i < n; i++)
{
gets(a);
len = strlen(a);
for(j = 0; j < len; j++)
{
if(a[j] >= 'A' && a[j] <= 'Z')
{
a[j] = a[j] + 32;
}
}
root = creat(root);
}
fin(root);
return 0;
}

数据结构实验之查找三:树的种类统计(SDUT 3375)的更多相关文章

  1. SDUT 3375 数据结构实验之查找三:树的种类统计

    数据结构实验之查找三:树的种类统计 Time Limit: 400MS Memory Limit: 65536KB Submit Statistic Problem Description 随着卫星成 ...

  2. SDUT-3375_数据结构实验之查找三:树的种类统计

    数据结构实验之查找三:树的种类统计 Time Limit: 400 ms Memory Limit: 65536 KiB Problem Description 随着卫星成像技术的应用,自然资源研究机 ...

  3. 数据结构实验之图论三:判断可达性(SDUT 2138)(简单DFS)

    #include <bits/stdc++.h> using namespace std; int gra[1002][1005]; int vis[1002]; int n,m; voi ...

  4. SDUT 3374 数据结构实验之查找二:平衡二叉树

    数据结构实验之查找二:平衡二叉树 Time Limit: 400MS Memory Limit: 65536KB Submit Statistic Problem Description 根据给定的输 ...

  5. SDUT-3373_数据结构实验之查找一:二叉排序树

    数据结构实验之查找一:二叉排序树 Time Limit: 400 ms Memory Limit: 65536 KiB Problem Description 对应给定的一个序列可以唯一确定一棵二叉排 ...

  6. SDUT 3311 数据结构实验之串三:KMP应用

    数据结构实验之串三:KMP应用 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 有n个小朋友 ...

  7. SDUT 3347 数据结构实验之数组三:快速转置

    数据结构实验之数组三:快速转置 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 转置运算是一 ...

  8. SDUT OJ 数据结构实验之二叉树三:统计叶子数

    数据结构实验之二叉树三:统计叶子数 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Descr ...

  9. SDUT OJ 数据结构实验之串三:KMP应用

    数据结构实验之串三:KMP应用 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Descrip ...

随机推荐

  1. 【转】使用ASP.NET Web API构建Restful API

    https://blog.csdn.net/mzl87/article/details/84947623 要点:使用DTO将内部实体与传输实体分离,利用Automapper实现两者的自动映射

  2. VS.NET(C#-2.5)_简单例子(所有控件都转换成HTML控件)

    简单例子 UI设计视图  UI代码视图 <% @PageLanguage="C#" AutoEventWireup="true"CodeFile=&quo ...

  3. WinForm 无焦点获取键盘输入

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.D ...

  4. Django中ORM多对多表的操作

    自己创建第三张表建立多对多关系 表的创建 # 老师表和学生表可以是一个多对多的关系,建表时可以手动建立第三张表建立关联 class Student(models.Model): name = mode ...

  5. 正padding负margin实现多列等高布局(转)

    转自: 巧妙运用CSS中的负值 (http://www.webhek.com/post/2345qwerqwer.html) 代码来自: https://codepen.io/Chokcoco/pen ...

  6. sql server 2012 分页/dapper/C#拼sql/免储存过程/简易

    sql server 2012新特性, 支持 OFFSET/FETCH分页, 就像mysql的limit, 比之前的各种top舒服多了,  看各位大佬们的测评文章说效率也是不相上下的, 有时候写个小工 ...

  7. pip3升级问题

    输入命令sudo pip3 install --upgrade pip 升级完成之后执行pip命令会报错,错误信息如下: File "/usr/bin/pip3", line 9, ...

  8. shell 三剑客之 sed pattern 详解

    sed 基础介绍 语法格式 sed 处理过程 sed 选项 cat sed.txt '-p' 打印输出 ,默认输出两次,流输出一次,源文件输出一次 sed 'p' sed.txt -n  只显示处理的 ...

  9. C# 中的匿名函数使用

    需求:在图一的callback函数中,我需要使用4个参数,但是又不想把四个参数都传入到requestImg 里面,可以采用上面的 匿名函数的做法.

  10. (备忘)jeecg的$.dialog的一些参数

    jeecg表单弹出框采用的技术是lhgdialog 一.配置全局默认参数 (function(config){ config['extendDrag'] = true; // 注意,此配置参数只能在这 ...