There are numbers from 1 to n, which are inverted such that
it results in numbers from n to 1. If only two consecutive
numbers are stampled at a time and are inverted, how many
moves are required?
Answer Posted / venomvendor
Answer is
Sigma(count), where count ranges from [1 to {n-(swap per time -1)}]
n-(swap per time - 1)
Σ i
i=1
Image Notation >> http://imgur.com/6HkcXzP
In this case.
n = n
swap per time = 2
Substituting this, we get
n-(2 - 1)
Σ i
i=1
n-1
Σ i
i=1
1+2+3+ . . . + (n-1)
if n = 5
Total swaps would be
1+2+3+4 = 10
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Define Routing Algorithm?
What are the complexities of sorting algorithms and how can this complexity be calculated?
What is bidirectional search algorithm?
Which search algorithm will use a limited amount of memory in online search?
What is simulated annealing algorithm?
Can you pick an algorithm. Write the psuedo-code for a parallel implementation?
Which algorithm in ‘unification and lifting’ takes two sentences and returns a unifier?
What is the iterative deepening depth-first search algorithm?
What is breadth-first search algorithm?
can anyone help me with some suggestions and improvemnts for sage line 50?
what is software cycle?give a diagramatic representation
What do you mean by overfitting and underfitting algorithms?
Sorting algorithms and time complexity of various algorithms.
What is greedy best first search algorithm?
What’s your favorite algorithm, & can you explain it into me in less than a minute?