Review that a change of length n is a cluster comprising of n unmistakable integers from 1 to n in discretionary request. For instance, [2,3,1,5,4] is a change of length 5, yet [1,2,2] isn't a stage (2 shows up twice in the exhibit) and [1,3,4] is additionally not a change (n=3 but rather there is 4 in the cluster).    Your undertaking is to track

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter18: Stacks And Queues
Section: Chapter Questions
Problem 16PE: The implementation of a queue in an array, as given in this chapter, uses the variable count to...
icon
Related questions
Question

Correct answer will be upvoted else Multiple Downvoted. Computer science.

You are given one integer n (n>1). 

 

Review that a change of length n is a cluster comprising of n unmistakable integers from 1 to n in discretionary request. For instance, [2,3,1,5,4] is a change of length 5, yet [1,2,2] isn't a stage (2 shows up twice in the exhibit) and [1,3,4] is additionally not a change (n=3 but rather there is 4 in the cluster). 

 

Your undertaking is to track down a stage p of length n that there is no file I (1≤i≤n) to such an extent that pi=i (along these lines, for all I from 1 to n the condition pi≠i ought to be fulfilled). 

 

You need to answer t autonomous experiments. 

 

In case there are a few replies, you can print any. It tends to be demonstrated that the appropriate response exists for each n>1. 

 

Input 

 

The main line of the input contains one integer t (1≤t≤100) — the number of experiments. Then, at that point, t experiments follow. 

 

The main line of the experiment contains one integer n (2≤n≤100) — the length of the stage you need to find. 

 

Output 

 

For each experiment, print n particular integers p1,p2,… ,pn — a stage that there is no list I (1≤i≤n) to such an extent that pi=i (along these lines, for all I from 1 to n the condition pi≠i ought to be fulfilled). 

 

In case there are a few replies, you can print any. It very well may be demonstrated that the appropriate response exists for each n>1.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Types of trees
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning