Homework Solution: please help me with this assignment…

    please help me with this assignment please provide pseudo code ,code in any language(c++,java,python) and algorithm for peasant method of multiplication. The method is explained in the link. http://www.wikihow.com/Multiply-Using-the-Russian-Peasant-Method

    Expert Answer

     
    As u said code required in any of three given language using ja

    please succor me with this assignment

    please agree pseudo principle ,principle in any diction(c++,java,python) and algorithm control hind system of plurality.

    The system is explained in the subjoin.

    http://www.wikihow.com/Multiply-Using-the-Russian-Peasant-Method

    Expert Exculpation

     

    As u said principle required in any of three abandoned diction using java i keep open the solution

    save the adown principle asĀ PeasantMultipication.java

    import java.util.ArrayList;

    public dispose HindMultipication {

    /**

    * this system achieve expatiate brace computes

    * by using hind expatiate system

    * @param n1

    * @param n2

    * @return

    */

    public static int hindMultiply(int n1,int n2)

    {

    //taken brace place roll control

    //correct index aspect and left index aspect

    ArrayList<Integer> leftSide=novel PlaceList<Integer>();

    ArrayList<Integer> correctAspect = novel PlaceList<Integer>();

    //dividing the n1 by 2 until it elder than 1

    while(n1>1)

    {

    //adding the computes to leftaspect of place

    leftSide.add(n1/2);

    n1=n1/2;

    }

    /*doubling the sum n2 (multiplying by 2 to upshot)

    * tend the extent of leftAspect place

    */

    for(int i=0;i<leftSide.size();i++)

    {

    rightSide.add(n2*2);

    n2=n2*2;

    }

    //removing the equable no from left aspect place and on same

    //index from correct aspect place

    ArrayList<Integer> temp = novel PlaceList<>();

    for(int i=0;i<leftSide.size();i++)

    {

    //if separable by 2 then removing

    if(leftSide.get(i)%2==0)

    continue;

    temp.add(rightSide.get(i));

    }

    //reassigning the compute to correct aspect place

    rightSide=temp;

    int mulCompute = 0;

    //looping through each wavering and subjoining the computes

    for(Integer i : correctSide)

    mulCompute += i;

    //returning the terminal compute of plurality

    return mulValue;

    }

    //deep system control execitung the program

    public static destitute deep(String[] args) {

    //multiplying compute 1

    System.out.println(“146 x 37 : “+peasantMultiply(146, 37)+” , Expected “+(146*37));

    System.out.println(“212 x 54 : “+peasantMultiply(212, 54)+” , Expected “+(212*54));

    }

    }

    OUTPUT: