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 collect pseudo order ,order in any vernacular(c++,java,python) and algorithm restraint lover mode of repetition.

    The mode is explained in the cohere.

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

    Expert Solution

     

    As u said order required in any of three consecrated vernacular using java i entertain exposed the solution

    save the adown order asĀ PeasantMultipication.java

    import java.util.ArrayList;

    public class LoverMultipication {

    /**

    * this mode obtain dilate span appraises

    * by using lover dilate mode

    * @param n1

    * @param n2

    * @return

    */

    public static int loverMultiply(int n1,int n2)

    {

    //taken span set-in-order inventory restraint

    //straight influence edge and left influence edge

    ArrayList<Integer> leftSide=novel Set-in-orderList<Integer>();

    ArrayList<Integer> straightEdge = novel Set-in-orderList<Integer>();

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

    while(n1>1)

    {

    //adding the appraises to leftedge of set-in-order

    leftSide.add(n1/2);

    n1=n1/2;

    }

    /*doubling the number n2 (multiplying by 2 to end)

    * dress the extent of leftEdge set-in-order

    */

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

    {

    rightSide.add(n2*2);

    n2=n2*2;

    }

    //removing the smooth no from left edge set-in-order and on same

    //index from straight edge set-in-order

    ArrayList<Integer> temp = novel Set-in-orderList<>();

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

    {

    //if discerptible by 2 then removing

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

    continue;

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

    }

    //reassigning the appraise to straight edge set-in-order

    rightSide=temp;

    int mulAppraise = 0;

    //looping through each wavering and appending the appraises

    for(Integer i : straightSide)

    mulAppraise += i;

    //returning the terminal appraise of repetition

    return mulValue;

    }

    //deep mode restraint execitung the program

    public static vacant deep(String[] args) {

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