Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm having a little trouble on my computer science homework. Our professor provided us with the outline of some code that we have to complete

I'm having a little trouble on my computer science homework. Our professor provided us with the outline of some code that we have to complete and I'm having trouble figuring out how to do some of them. Here is a segment I was working that was giving me trouble:

public class myGenericLinkedList { //this class will define a Linked list whose node stores item that is a generic type genericNode head;//a reference variable refers to the first node of the linked list genericNode tail;//a reference variable refers to the last node of the linked list

/* Remark: * 1. for all operations that you are going to provide in this lab, * if the operation changes the first or the last or both nodes, * make sure you update the reference variable accordingly * 2. use equals, compareTo when necessary instead of arithmetic operator when there is a need */

public myGenericLinkedList(){ head=null; tail=null; }

public static boolean isEmpty(){ if(myGenericLinkedList.isEmpty()) { return true; } else { return false; } /** * check if the list is empty * @return true for yes, false for no */ }

public int size(){ /** * check the number of nodes in the list * @return the number of nodes */ }

public boolean search(E target){ for(int i = 0; i < E.length; i++) { } /** * search for a target in the list * @param target--the target item * @return true for yes, false for no * use equals, compareTo when necessary instead of arithmetic operator */ }

How do I do this? In java please and if you need more information let me know.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beyond Big Data Using Social MDM To Drive Deep Customer Insight

Authors: Martin Oberhofer, Eberhard Hechler

1st Edition

0133509796, 9780133509793

Students also viewed these Databases questions