当前位置:网站首页>Bucket sorting (C language)
Bucket sorting (C language)
2022-06-30 14:53:00 【Tongxuan Shangjing programmer】
give an example : Put five in 0~10 Sort by the number between .
Ideas :
1. Create a one-dimensional array a[11]
2. Initialize to zero
3. Read the five numbers entered into the variable for counting
4. Printout
#include<stdio.h>
int main()
{
int a[11],i,j,t;// Create a one-dimensional array
for(i=0;i<=10;i++)
a[i]=0;// Initialize to zero
for(i=1;i<=5;i++)
{ scanf("%d",&t);a[t]++; }// Count
for(i=0;i<=10;i++)// Judge in turn
for(j=0;j<=a[i];j++)// Print
printf("%d ",i);
return 0;
} 边栏推荐
- Att & CK red team evaluation field (I)
- CCF date calculation (Full Score code + skill summary) February 2, 2015
- Not satisfied with markdown native code block style? Try this beautify code screenshot tool~~
- Double pointer circular linked list
- CCF window (Full Score code + problem solving idea) March 2, 2014
- Solve the problem that codeblocks20.03 on win11 cannot run for the first time
- CCF image rotation (Full Score code + problem solving idea) 201503-01
- Searching for single element in dichotomy
- NoViableAltException([email protected][])
- Shift operator (detailed)
猜你喜欢

PS cutting height 1px, Y-axis tiling background image problem

XSS challenge (1-5) more detailed answers

CCF elimination games (Full Score code + problem solving ideas + skill summary) February 2, 2015

How does hbuilder display in columns?

Using docker to manage MySQL services under Windows

Clear the route cache in Vue

How to realize selective screen recording for EV screen recording

@PathVariable

The first dark spring cup dnuictf

ThinkPHP v3.2 comment annotation injection write shell
随机推荐
Computer screenshot how to cut the mouse in
【BUUCTF】 EasySql
XSS challenge (1-5) more detailed answers
Vue returns to the previous page without refreshing the page / Vue caches the page
Working principle and fault treatment of cutting cylinder in CNC machining center
数控加工中心打刀缸工作原理及故障处理
ThinkPHP show method parameter controllable command execution
【BUUCTF】[GXYCTF2019]Ping Ping Ping1
CCF numerical sorting (Full Score code + problem solving ideas + skill summary) 201503-2
ThinkPHP v3.2 comment annotation injection write shell
IO interview questions
1135: paired base chain
Effect of shadow around the block after mouse over
Learn about data kinship JSON format design from sqlflow JSON format
Lfi-rce without controllable documents
ES6 notes
One dimensional and two dimensional array addresses
PS dynamic drawing
Location of dichotomy
2021-05-12