hi , i need a logical help my program should be about:
int W;
it means there will be 2 lines , in every line there will be W numbers unordered from 1 to W , example , lets say w is 5
First Line : 1 2 3 4 5
Second Line : 2 4 5 3 1
both of these lines are entered by User , then you can "pull" each number just once , but when you do it means , the first Line is : 1 2 3 4 5 , you pull "3" so then the number 3 goes on the end of the sequence and all the numbers which where on the position of pulled number to right are being pushed back to the left so we got :1 2 4 5 3 and then we do the same with "1" and we will have 2 4 5 3 1 , we did just 2 steps to do this : so the minimum of steps like this , to transform the first line sequence to the second line sequence is 2 , then you also have to say , what would be the Maximum of steps like this to transform first line sequence to the second line sequence , dont forget , that you can pull each number just once , i dont want whole code , i just need somekind of logical help , anyone is up to help me please ?
so my goal is to check the minimum steps to transform it , and also the maximum possible amount of steps to do the same
To me, the maximum steps, would be the amount of numbers being used. If you say the value of W is 5, then you can only move 5 times, etc. Minimum, is 1. Depending on the order of each array.
Here's my version, up to a point. I fill the arrays randomly, not user inputted. At least it gives you ideas, (hopefully), and you can expand it to what your needs are.