Turbo Sort||codechef||beginner solution ||programming info

Turbo Sort

Given the list of numbers, you are to sort them in non decreasing order.

Input

t – the number of numbers in list, then t lines follow [t <= 10^6].
Each line contains one integer: N [0 <= N <= 10^6]

Output

Output given numbers in non decreasing order.

Example

Input:
5
5
3
6
7
1
Output:
1
3
5
6
7
Solution using C++ language:
#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main() {
 // your code goes here
 int t,i;
 cin>>t;
 int a[t];
 for(i=0;i<t;i++)
 {
     cin>>a[i];
 }
 sort(a,a+t);
 for(i=0;i<t;i++)
 {
     cout<<a[i]<<endl;
 }
 return 0;
}

Share:

No comments:

Post a Comment

Translate

Recommended platforms

  1. codechef
  2. hackerrank
  3. codeforces
  4. leetcode
  5. hackerearth

Popular Posts

programming_info. Powered by Blogger.

Blog Archive

Recent Posts

other platforms

  • geeks for geeks
  • w3schools
  • codepen
  • skillshare
  • udemy

Pages

reader support Support