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 contribute pseudo order ,order in any accents(c++,java,python) and algorithm restraint rustic system of plurality.

    The system is explained in the incorporate.

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

    Expert Counter-argument

     

    As u said order required in any of three ardent accents using java i enjoy exposed the solution

    save the adown order asĀ PeasantMultipication.java

    import java.util.ArrayList;

    public tabulate RusticMultipication {

    /**

    * this system earn increase couple appreciates

    * by using rustic increase system

    * @param n1

    * @param n2

    * @return

    */

    public static int rusticMultiply(int n1,int n2)

    {

    //taken couple adorn roll restraint

    //equitable laborer interest and left laborer interest

    ArrayList<Integer> leftSide=fantastic AdornList<Integer>();

    ArrayList<Integer> equitableInterest = fantastic AdornList<Integer>();

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

    while(n1>1)

    {

    //adding the appreciates to leftinterest of adorn

    leftSide.add(n1/2);

    n1=n1/2;

    }

    /*doubling the enumerate n2 (multiplying by 2 to conclusion)

    * cultivate the magnitude of leftInterest adorn

    */

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

    {

    rightSide.add(n2*2);

    n2=n2*2;

    }

    //removing the equable no from left interest adorn and on same

    //index from equitable interest adorn

    ArrayList<Integer> temp = fantastic AdornList<>();

    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 appreciate to equitable interest adorn

    rightSide=temp;

    int mulAppreciate = 0;

    //looping through each capricious and gathering the appreciates

    for(Integer i : equitableSide)

    mulAppreciate += i;

    //returning the developed appreciate of plurality

    return mulValue;

    }

    //main system restraint execitung the program

    public static empty main(String[] args) {

    //multiplying appreciate 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: