首页 > 试题广场 >

排序

[编程题]排序
  • 热度指数:42172 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 64M,其他语言128M
  • 算法知识视频讲解
    对输入的n个数进行排序并输出。

输入描述:
    输入的第一行包括一个整数n(1<=n<=100)。
    接下来的一行包括n个整数。


输出描述:
    可能有多组测试数据,对于每组数据,将排序后的n个整数输出,每个数后面都有一个空格。
    每组测试数据的结果占一行。
示例1

输入

4
1 4 3 2

输出

1 2 3 4 
头像 Dawn_Breaks
发表于 2021-07-07 15:33:19
//所有基本的排序方法了,桶排序、基数排序暂不写了 #include<iostream> using namespace std; const int N = 110, MAX = 1e8; int a[N]; int n; int h[N], idx;//heap_sort用 int 展开全文
头像 牛客746439053号
发表于 2022-01-12 11:39:34
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; // 插入排序 void InsertSort(int arr[], int len) { for 展开全文
头像 帅呆呆~
发表于 2022-03-05 13:41:59
#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int MAXN = 100 + 10; int arr[MAXN]; int main( 展开全文
头像 渺小小螃蟹
发表于 2021-05-09 09:32:23
#include<stdio.h> int main() { int n; int a[200]; scanf("%d",&n); int i; for(i=1;i<=n;i++) { scanf("%d", 展开全文
头像 乌龟狗的齐天大圣
发表于 2023-02-17 18:28:07
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main(){ int n; while(scanf("%d",&n) != E 展开全文
头像 在考古的小鱼干很有气魄
发表于 2023-03-06 09:56:06
#include <bits/stdc++.h> #define MAX 100 using namespace std; int main(){ int n,data[MAX]; cin>>n; for(int i = 0; i < n; i++) cin 展开全文
头像 IAMCKAI
发表于 2022-03-23 19:45:09
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; const int MaxSize = 100 + 10; int arr[MaxSize]; 展开全文
头像 辣椒味的糖葫芦
发表于 2023-03-22 14:17:25
import heapq def px(nums:list):#堆排序 ans=[] while nums: heapq.heapify(nums) ans.append(nums[0]) del(nums[0]) return 展开全文
头像 imthewinger
发表于 2023-03-14 21:32:16
#include<iostream> #include<algorithm> using namespace std; //主要学一下sort函数 //毕竟正常机试不会让我自己实现一个排序算法吧 int main() { //sort //sort(fir 展开全文
头像 在抱佛脚的海豚很想吃烤肉
发表于 2023-02-04 21:01:55
#include <stdio.h> int main() { int n; while ((scanf("%d", &n)) != EOF) { int Arr[n]; for (int i = 0; i < n; i++) { 展开全文