C programming question
please meet all of the following conditions don't just output the same answer


Here is the required program
I've used insertion sort for sorting
#include<stdio.h>
struct sequence{ //structure for storing a sequence together
int index;
int admin_level;
int license_no;
};
int main()
{
int a;
scanf("%d",&a); //input of no. of lines
struct sequence ar[a+1];
struct sequence temp;
for(int i=1;i<=a;i++)
{
ar[i].index=i; //generate index
no.
scanf("%d%d",&ar[i].admin_level,&ar[i].license_no);
}
for(int i=2;i<=a;i++) //use insertion sort
{
for(int j=i;j>1;j--)
{
if(ar[j].admin_level<ar[j-1].admin_level)
{
temp=ar[j];
ar[j]=ar[j-1];
ar[j-1]=temp;
}
else
if(ar[j].admin_level==ar[j-1].admin_level )
{
if(ar[j].license_no<ar[j-1].license_no){
temp=ar[j];
ar[j]=ar[j-1];
ar[j-1]=temp;
}
else
if(ar[j].license_no==ar[j-1].license_no)
{
if(ar[j].index<ar[j].index)
{
temp=ar[j];
ar[j]=ar[j-1];
ar[j-1]=temp;
}
else
{
break;
}
}
else
{
break;
}
}
else
break;
}
}
printf("%d", ar[1]);;
for(int i=2;i<=a;i++) //loop for printing out the
result
printf(" %d",ar[i].index);
printf("\n");
}
here is the ss of the output

I hope this will help you so please give positive ratings :)))
C programming question please meet all of the following conditions don't just output the same answer Given a...
Plz i want answer these question using list in python
programme.
You are given two sequences of n integers: 21, 22, ...,an and b1,b2, ..., bn Print a sequence of 2n integers created by alternating elements from the given sequences: a1, 61, 42, 62, a3, 63, ..., an, bn. Input The first line contains a positive integer n (1 <n<1000) - the length of the sequences The second line contains n space-separated integers 01, 02, ..., an (-1000 <a; <...
LINUX C programming Please make sure the output is correct Please do read data from file, the example below is just a example Third: Hash table (20 points) In this part, you will implement a hash table containing integers. The hash table has 10,000 buckets. An important part of a hash table is collision resolution. In this assignment, we want you to use chaining with a linked list to handle a collision. This means that if there is a collision...
I want this using while loop
This using stringin python
Use list or some thing in python
Using list in python
I want answer as soon as posdible
E. Last Number time limit per test: 1 second memory limit per test: 256 megabytes input standard input output standard output You are given a sequence of positive integers aj, , 03, ... Print the last element of the sequence. Input The input consists of multiple lines. The i-th line contains a...
Please don't use a void fuction and this is a c++ question.
Thanks
Write a program that reads two input files whose lines are ordered by a key data field. Your program should merge these two files, writing an output file that contains all lines from both files ordered by the same key field. As an example, if two input files contain student names and grades for a particular class ordered by name, merge the information as shown below Using...
Description An array in C++ is a collection of items stored at contiguous memory locations and elements can be accessed randomly using indices of an array. They are used to store similar type of elements as in the data type must be the same for all elements. One advantage of arrays is easy data manipulation and accessibility of elements stored in consecutive locations. The Problem: One teaching assistant of a computer science department in Engineering University got a simple question...
C++
You're given the pointer to the head nodes of two linked lists. Compare the data in the nodes of the linked lists to check if they are equal. The lists are equal only if they have the same number of nodes and corresponding nodes contain the same data. Either head pointer given may be null meaning that the corresponding list is empty. Input Format You have to complete the int CompareLists (Node headA, Node* head B) method which takes...
Topic:Data structures and algorithms
programming
Compiler:C++ 11, flag: -static -std=c++0x
Boring job One day, Rick got a sequence of N magic numbers. In order to find the latent code in the sequence, he decides to do the following operations with a magic parameter K: Step (1) Take out the first k numbers from current sequences into a temporary sequence ni namn, and pick the largest element Vmax out of these k numbers, then subtract 1 from the remaining K-1 elements....
the question from the course COMP 4040 that Analysis of
Algorithms
if you want to answer it by code please use C or C++
5. Algorithm Design (20 points) Input: array A contains n distinct numbers from 1 to n, in arbitrary order. Output: number of inversions (defined as the number of pair(i, j) of array indices with i < j and A[i] > Aj]) (a) (5 points) What array with elements from the set {1, 2, ..., n) has...
Java Program Create a class to store an array of with enough space to store 10 integer values. Using the principle of recursion, implement the following: *getSize : returns the size of the array. *get (i): returns the i-th element of the array. If the element does not exist, it throws a "NoSuchElementException” which is a subclass of Java class RunTimeException. *add (val): inserts value as the last element of the array. If necessary, double the size of the current...
C Programming Language Problem Title: Jojo’s Hardest Problem (?) Jojo is enjoying his vacation with his family. Suddenly an instant message came in. Apparently there is a message from Lili : ”Jojo, don’t forget to check the forum. Who knows if there is an assignment before the exam” Jojo finally took the time to check the discussion forum and sure enough, there were some assignments given to his class. He immediately told his classmates. Jojo finds out one difficult problem...