Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

help me Write the following ML functions a) Write a function that takes two list

ID: 3598883 • Letter: H

Question

help me Write the following ML functions

a) Write a function that takes two lists as parameter and deletes from the front of the first list as many elements as there are in the second list. If the first list is shorter than the second list, return nil. Sample Run: dels(t2,5,1,8], [4,3]); there are 2 elements in the second list, so delete 2 elemenls val it= [1,8] : int list deist 2,5], [4,5,3]); first istis shorter so return nil from the first ist yal it-11: int list , b). Assumingthatan int list-contains the digits of an integer, write a function which takes this list as a parameter as welf as an integer which is a power of 10. The function should return a list which contains the digits of their product. Sample Run: mult E5,3,2,1000); multiply 532 by 1000 val it [5,3,2,0,0,01 : int list Note: Write only one function for each part, and do not call any other functions

Explanation / Answer

I have implemente the program for both scenario find below

a). First function

static List<Integer> deleteList(List<Integer> list1,List<Integer> list2){

List<Integer> list = new ArrayList();

if(list1.size()<list2.size()){

return null;

}

for(int i=list2.size();i<list1.size();i++){

list.add(list1.get(i));

}

return list;

}

b). second function

static List<Integer> mulList(List<Integer> list1,int n){

String s = Integer.toString(n);

int length = s.length();

for(int i=0;i<length-1;i++){

list1.add(0);

}

return list1;

}

Please let me know if you have any query related to this program. you can comments