Question
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
/* 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
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