Alan J.

asked • 23d

Please can anyone solve the given methods on Linked lists. I need help. Thank you in advance.

A) Write a function to find out the even numbers that are present in the list and output another list with those numbers. (3)


Sample Input Sample Output
1 -> 2 -> 5 -> 3 -> 8 2 -> 8
101 -> 120 -> 25 -> 91-> 87 -> 1 120


B) Write a function to find out if the element is in the list or not. (3)


Sample Input Sample Output
1 -> 2 -> 5 -> 3-> 8 and 7 False
101 -> 120 -> 25 -> 91-> 87 -> 1 and 87 True


Note:

For the case of JAVA, you must include the Tester class containing the main method which should test your other methods in MyList class and print the outputs according to the tasks.


For the case of PYTHON, make sure your code has the methods invoked through test statements and proper printing statements according to the tasks. You may create a separate Tester class for this or test the methods within the MyList class.


USAGE OF BUILT IN METHODS / LIBRARIES are NOT ALLOWED.


1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.