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 / 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 |
Given a series of positive integers. Design an efficient algorithm that can detect pairs whose sum is equal to K such that K = ei + ej, and (i not equal to j).
Name search algorithm technology?
What is meant by uniform cost search algorithm?
What is local search algorithms?
What is the breadth-first search algorithm?
what is software cycle?give a diagramatic representation
Tell briefly about the Banker's algorithm and what is it used for?
Draw a flowchart to find the average of four number?
What do you mean by overfitting and underfitting algorithms?
Tell me how do you choose an algorithm for a classification problem?
What is the most efficient way to store 1 million phone numbers memory-wise?
What is bidirectional search algorithm?