Question
1-implement zip method in Q1 class to merge two linkedlists into one. * The elements in the result are made by concatenating elements in different
1-implement zip method in Q1 class to merge two linkedlists into one. * The elements in the result are made by concatenating elements in different * linkedlists one after one. The order of the elements matters. * For example, merge(list1, list2) should return [1,5,2,4,3,3,4,2,5,1]. * You can assume that arr1 and arr2 has the same size. * HINT: You should use ListIterator to make it easier.
Integer[] arr1 = {1,2,3,4,5}; Integer[] arr2 = {5,4,3,2,1}; LinkedList
2- implement reverse method in Q2 class to reverse a string with stack. * For example, string "wonderful" will return "lufrednow". * NOTE: reverse without using a stack will result in 0 for this question.
String word = "wonderful"; System.out.println("Q2 = [15 marks] ================================="); System.out.println(Q2.reverse(word));
3- create Q3 class to implement comparator for a TreeSet. The purpose of * the comparator is to compare the alphabetic order of integers. With Q3, * the order of Integer elements will be sort according to the order of * digit Unicode. * For example, the value of {11,3,31,2} will return {11,2,3,31} * NOTE: You don't need to compare each digit one by one. Just compare them * as strings.
System.out.println("Q3 = [15 marks] ================================="); Set
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started