Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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)
&#931; 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)
&#931; i
i=1

n-1
&#931; 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


Please Help Members By Posting Answers For Below Questions

Define Routing Algorithm?

996


What is depth-first search algorithm?

903


What is software cycle? Give a diagrammatic representation?

837


Consider the following algorithm, where the array A is indexed 1 through n: int add_them ( int n , int A[ ] ) { index i , j , k ; j = 0 ; for ( i = 1 ; i <= n ; i++) j = j + A[i] ; k = 1 ; for ( i = 1 ; i <= n ; i++) k = k + k ; return j + k ; } (a) If n = 5 and the array A contains 2, 5, 3, 7, and 8, what is returned? (b) What is the time complexity T(n) of the algorithm?

2356


Give a general algorithm for converting a m-array tree to a 2-ary tree.

949


Which is the most straight forward approach for planning algorithms?

1028


What is meant by uniform cost search algorithm?

854


Which search algorithm will use a limited amount of memory in an online search?

1149


Write a code/algorithm to find the frequency of each element in an array?

889


What are disadvantages uniform cost search algorithm?

1560


Which algorithm inverts a complete resolution strategy?

1114


Which algorithm is used for solving temporal probabilistic reasoning?

1044


Can you pick an algorithm. Write the psuedo-code for a parallel implementation?

840


list the types of linked list with aid of diagram?

2626


What do you mean by overfitting and underfitting algorithms?

964