Jumpstart Your Paper

Browse our Free Essay examples and check out our Writing tools to get your assignments done.

Data Structure

INSTRUCTIONS:

Part A – coding 1. Implement Singly Linked List detectLoop which check whether the linked list contains a loop. - It’s an instance method that takes no parameter. It returns true if the linked list contains a loop that goes on forever if tracing the list from head. It returns false if it does not contain a loop. This method should be O(n), n as the number of nodes in the linked list. 2. Complete Doubly Linked List get method which behaves like the operator[] of array. - It’s an instance method that takes a position and an element, and then returns the element from this specific position. It throws an exception if the position is out of bound. It traverses the list from header if the position is closer to the header and traverses the list from trailer otherwise. Part of the method is given. 3. Implement Polynomial Linked List add method which adds two polynomials in standard form and returns sum polynomial which also has to be in standard form. - Rewrite the instance method by merging the caller and parameter Polynomial Linked List into another sum Polynomial. Both caller and parameter Polynomials are expected to be in standard form, the method should return the sum Polynomial also in standard form. A standard form polynomial has no duplicate terms (each term’s exponent is unique) and the exponent is in descending order. This method should be O(n), n as the number of terms in the sum polynomial. Extra Credit: Implement Polynomial Linked list multiply method, similar to add, it returns the result polynomial in standard form. Submit: Please download the given assignment Linked List https://venus.cs.qc.cuny.edu/~yang/sp21/cs313/cs313/Assignment/A1LinkedList.java Change the file and class name to include your initials at the end. eg, if your name is John Smith, please change the file to A1LinkedListSJ and include your name at the very top of the program as comments.
Related Topics: