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 |
What is the breadth-first search algorithm?
Which is the most straight forward approach for planning algorithms?
What are disadvantages uniform cost search algorithm?
Explain the concept behind dead lock avoidance, banker's algorithm.
0 Answers HPCL, Hughes Systique Corporation,
Give an example of an O (n) algorithm and O (n*n) algorithm such that the algorithm is slower.
Consider the following algorithm: for ( i = 2 ; i <= n ; i++) { for ( j = 0 ; j <= n) { cout << i << j ; j = j + floor(n/4) ; } } (a) What is the output when n = 4 (b) What is the time complexity T(n). You may assume that n is divisible 4.
What is meant by uniform cost search algorithm?
Give a general algorithm for converting a m-array tree to a 2-ary tree.
What is the uniform cost search algorithm?
What is Back propagation in Neural Networks?
Why size of integer depends on the machine architecture then what the best sorting algorithm and why?
0 Answers HPCL, Hughes Systique Corporation,
Write the Shortest path algorithm for a graph.
AI Algorithms (74)
AI Natural Language Processing (96)
AI Knowledge Representation Reasoning (12)
AI Robotics (183)
AI Computer Vision (13)
AI Neural Networks (66)
AI Fuzzy Logic (31)
AI Games (8)
AI Languages (141)
AI Tools (11)
AI Machine Learning (659)
Data Science (671)
Data Mining (120)
AI Deep Learning (111)
Generative AI (153)
AI Frameworks Libraries (197)
AI Ethics Safety (100)
AI Applications (427)
AI General (197)
AI AllOther (6)