当前位置:网站首页>Bucket sorting in C language
Bucket sorting in C language
2022-07-03 14:36:00 【roseisbule】
When we're dealing with it c When de duplication of super large data in language , The running efficiency of the program will be very low , The running memory will be very large .

Such as this topic , The background gives a huge amount of data , If we write ordinary counting and sorting functions, we will not be able to process these data , So we need to find a stronger idea .
Our normal method is , Create an array , Store every element , But this will cause the array to be very large . So we changed our mind , Use subscripts to store data , Let the element content store the number of occurrences of this small mark , It's easy to solve . The code is as follows .
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#define NUM 500000
int main()
{
int arr[NUM] = { 0 };
int num = 0;
int tmp = 0;
scanf("%d", &num);
for (; num >0; num--)
{
tmp = 0;
scanf("%d", &tmp);
arr[tmp]++;
}
for (num = 0; num < NUM; num++)
{
if (arr[num] != 0)
printf("%d ", num);
}
return 0;
}
边栏推荐
- Zhonggan micro sprint technology innovation board: annual revenue of 240million, net loss of 17.82 million, proposed to raise 600million
- Happy capital new dual currency fund nearly 4billion yuan completed its first account closing
- Zzuli:1057 prime number determination
- Bibit pharmaceutical rushed to the scientific innovation board: annual revenue of 970000, loss of 137million, proposed to raise 2billion
- 7-17 crawling worms (break exercise)
- Statistical capital consonants
- 天谋科技 Timecho 完成近亿元人民币天使轮融资,打造工业物联网原生时序数据库
- Sendmail无法发送邮件及发送过慢解决
- X86 assembly language - Notes from real mode to protected mode
- Protobuf and grpc
猜你喜欢

ShowMeBug入驻腾讯会议,开启专业级技术面试时代

Sub-GHz无线解决方案Z-Wave 800 系列ZG23 soc和ZGM230S模块

如何查询淘宝天猫的宝贝类目

tonybot 人形机器人 查看端口并对应端口 0701

Dllexport and dllimport

tonybot 人形机器人 定距移动 代码编写玩法

Programming language: the essence of type system

Puzzle (016.3) is inextricably linked
![[qingniaochangping campus of Peking University] in the Internet industry, which positions are more popular as they get older?](/img/f6/fe61c84f289f0e74a45946dac687a6.jpg)
[qingniaochangping campus of Peking University] in the Internet industry, which positions are more popular as they get older?

NPM install is stuck with various strange errors of node NPY
随机推荐
7-20 print 99 formula table (format output)
556. 下一个更大元素 III
Jiuyi cloud black free encryption free version source code
Preliminary summary of structure
Zzuli:1053 sine function
Selective sorting
Accelerating strategy learning using parallel differentiable simulation
Why is this error reported when modifying records in the database
Luogu p3065 [usaco12dec]first! G problem solution
Luogu p5018 [noip2018 popularization group] symmetric binary tree problem solution
JVM garbage collector
ConstraintLayout 的使用
Timecho of Tianmou technology completed an angel round financing of nearly 100 million yuan to create a native timing database of the industrial Internet of things
7-6 mixed type data format input
Protobuf and grpc
Pyqt interface production (login + jump page)
分布式事务(Seata) 四大模式详解
7-17 crawling worms (break exercise)
1017 a divided by B (20 points)
如何查询淘宝天猫的宝贝类目