Question: Solve Exercise P16.4 recursively, by calling a recursive helper method private static boolean contains(Node start, Object obj) If start is null, then it cant

Solve Exercise •• P16.4 recursively, by calling a recursive helper method private static boolean contains(Node start, Object obj) If start is null, then it can’t contain the object. Otherwise, check start.data before recursively moving on to start.next.

Data from exercise P16.4 

Add a method boolean contains(Object obj) that checks whether our LinkedList implementation contains a given object. Implement this method by directly traversing the links, not by using an iterator.

Step by Step Solution

3.41 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Given the data from exercise P164 and the exercise question itself we need to solve it recursively T... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Programming Questions!