SlideShare a Scribd company logo
Note: Can someone help me with the private E get(int index, int currentIndex, Node n)method.
The code is not running. Also I need help with the public void add(int index, E element) method
too. Please use the parameters provided with the code to solve. package edu.ust.cisc; import
java.util.Iterator; import java.util.NoSuchElementException; public class CiscSortedLinkedList
> implements CiscList { /** * A reference to this list's dummy node. Its next reference should
refer to the node containing the first element * in this list, or it should refer to itself if the list is
empty. The next reference within the node containing * the last element in this list should refer to
dummy, thus creating a cyclic list. */ private Node dummy; /** * Number of elements in the list.
*/ private int size; /** * Constructs an empty CiscSortedLinkedList instance with a non-null
dummy node whose next reference refers to * itself. */ public CiscSortedLinkedList() { dummy
= new Node<>(null, null); dummy.next = dummy; } /** * Returns the number of elements in
this list. * * @return the number of elements in this list */ @Override public int size() { return
size; } /** * Returns {@code true} if this list contains no elements. * * @return {@code true} if
this list contains no elements */ @Override public boolean isEmpty() { return size==0; } /** *
Returns {@code true} if this list contains the specified element (compared using the {@code
equals} method). * This implementation should stop searching as soon as it is able to determine
that the specified element is not * present. * * @param o element whose presence in this list is to
be tested * @return {@code true} if this list contains the specified element * @throws
NullPointerException if the specified element is null */ @Override public boolean
contains(Object o) { if(o==null){ throw new NullPointerException(); } return
containsHelper(o,dummy.next); } private boolean containsHelper(Object o, Node node){
if(node== dummy){ return false; } else if(o.equals(node.data)){ return true; } else{ return
containsHelper(o,node.next); } } /** * Returns an iterator over the elements in this list in proper
sequence. * * @return an iterator over the elements in this list in proper sequence */ @Override
public Iterator iterator() { //return new Iterator (){ //private Node curr = dummy.next; //private
Node prev = dummy; //private boolean canRemove = false; return null; } /** * Returns an array
containing all of the elements in this list in proper sequence (from first to last element). *
The returned array will be "safe" in that no references to it are maintained by this list. (In other
words, * this method must allocate a new array even if this list is backed by an array). The caller
is thus free to modify * the returned array. * * @return an array containing all of the elements in
this list in proper sequence */ @Override public Object[] toArray() { Object[] arr = new
Object[size]; int i = 0; for(Node current = dummy;current!=null;current= current.next){ arr[i++]
= current.data; } return arr; } /** * {@link #toArray} recursive helper method. Adds the element
contained in the specified node to the specified index * in the specified array. Recursion stops
when the specified node is the dummy node. * * @param arr the array into which each element
in this list should be added * @param index the index into which the next element in this list
should be added * @param n the node containing the next element in this list to add to the array
*/ private void toArray(Object[] arr, int index, Node n) { } /** * Adds the specified element to
its sorted location in this list. * *
Lists may place the specified element at arbitrary locations if desired. In particular, an ordered
list will * insert the specified element at its sorted location. List classes should clearly specify in
their documentation * how elements will be added to the list if different from the default
behavior (end of this list). * * @param value element to be added to this list * @return {@code
true} * @throws NullPointerException if the specified element is null */ @Override public
boolean add(E value) { return false; } /** * {@link #add} recursive helper method. Adds the
specified value to the list in a new node following the specified * node (if that is the appropriate
location in the list). * * @param value element to be added to this list * @param n a reference to
the node possibly prior to the one created by this method */ private void add(E value, Node n) {
} /** * Removes the first occurrence of the specified element from this list, if it is present. If this
list does not * contain the element, it is unchanged. Returns {@code true} if this list contained
the specified element. This * implementation should stop searching as soon as it is able to
determine that the specified element is not * present. * * @param o element to be removed from
this list, if present * @return {@code true} if this list contained the specified element * @throws
NullPointerException if the specified element is null */ @Override public boolean
remove(Object o) { if(o==null){ throw new NullPointerException(); } Node curr = dummy.next;
Node prev = dummy; while (curr != dummy && !o.equals(curr.data)) { prev = curr; curr =
curr.next; } if (curr == dummy) { return false; } else { System.out.println("Removing
Data:"+curr.data); prev.next = curr.next; size--; return true; } } /** * {@link #remove} recursive
helper method. Removes the node following n if it contains the specified element. This *
implementation should stop searching as soon as it is able to determine that the specified element
is not * present. * * @param o element to be removed from this list, if present * @param n a
reference to the node prior to the one possibly containing the value to remove * @return */
private boolean remove(Object o, Node n) { return false; } /** * Removes all of the elements
from this list. The list will be empty after this call returns. @Override public void clear() {
dummy.next=dummy; size=0; } /** * Returns the element at the specified position in this list. *
* @param index index of the element to return * @return the element at the specified position in
this list * @throws IndexOutOfBoundsException if the index is out of range */ @Override
public E get(int index) { if(index<0 || index>=size){ throw new IndexOutOfBoundsException();
} Node curr = dummy.next; for(int i=0;i n) { if(index<0 || index>=size){ throw new
IndexOutOfBoundsException(); } Node curr = head; for(int i=0;i next_curr=curr.next;
curr.next=n; while(n.next) { n = n.next; //finding end of n headed linked list n.next =
next_curr;//adding rest linked list at end of n headed linked list } if(index==0) { return n; } else {
return head; } } /** * * @param index index of the element to replace * @param element
element to be stored at the specified position * @return the element previously at the specified
position * @throws UnsupportedOperationException if the {@code set} operation is not
supported by this list */ @Override public E set(int index, E element) { throw new
UnsupportedOperationException(); } /** * This operation is not supported by
CiscSortedLinkedList. * * @param index index at which the specified element is to be inserted *
@param element element to be inserted * @throws UnsupportedOperationException if the
{@code set} operation is not supported by this list */ @Override public void add(int index, E
element) { } /** * Appends all elements in the specified list to the end of this list, in the order
that they are returned by the * specified list's iterator. * * @param c list containing elements to
be added to this list * @return {@code true} if this list changed as a result of the call * @throws
NullPointerException if the specified list is null */ @Override public boolean addAll(CiscList
extends E> c) { return false; } /** * Removes the element at the specified position in this list.
Shifts any subsequent elements to the left * (subtracts one from their indices). Returns the
element that was removed from the list. * * @param index the index of the element to be
removed * @return the element previously at the specified position * @throws
IndexOutOfBoundsException if the index is out of range */ @Override public E remove(int
index) { return null; } /** * {@link #remove} recursive helper method. Removes the node
following n if it contains the element at the specified * index. * * @param index the index of the
element to be removed * @param currentIndex the index of the node parameter * @param n the
node containing the element at currentIndex * @return */ private E remove(int index, int
currentIndex, Node n) { return null; } /** * Returns the index of the first occurrence of the
specified element in this list, or -1 if this list does not * contain the element (compared using the
{@code equals} method). This implementation should stop searching as * soon as it is able to
determine that the specified element is not present. * @param o element to search for * @return
the index of the first occurrence of the specified element in this list, or -1 if this list does not *
contain the element * @throws NullPointerException if the specified element is null */
@Override public int indexOf(Object o) { if(o==null){ throw new NullPointerException(); }
return indexOf(o,0, dummy.next); } /** * {@link #indexOf} recursive helper method. Returns
currentIndex if the element contained in the node parameter is * equal to the specified element to
search for. This implementation should stop searching as soon as it is able to * determine that the
specified element is not present. * * @param o element to search for * @param currentIndex the
index of the node parameter * @param n the node containing the element at currentIndex *
@return the index of the first occurrence of the specified element in this list, or -1 if this list does
not * contain the element */ private int indexOf(Object o, int currentIndex, Node n) {
if(n.data.equals(o)){ return currentIndex; } else if(n==dummy){ return -1; } else
if(n.data.compareTo((E)o)>0){ return -1; } else{ return indexOf(o,currentIndex+1,n.next); } }
/** * Returns a string representation of this list. This string should consist of a comma separated
list of values * contained in this list, in order, surrounded by square brackets (examples: [3, 6, 7]
and []). * * @return a string representation of this list */ public String toString() { return null; }
/** * {@link #toString} recursive helper method. Returns a string representation of this list,
beginning with the * element in the specified node * * @param n the node containing the next
element to append to the string * @return a string representation of this list, beginning with the
element in the specified node */ private String toString(Node n) { return null; } private static
class Node { private E data; private Node next; private Node(E data, Node next) { this.data =
data; this.next = next; } } private class CiscLinkedListIterator implements Iterator { /** * A
reference to the node containing the next element to return, or to the dummy node if there are no
more * elements to return. */ private Node nextNode; /** * Constructs an iterator ready to return
the first element in the list (if present). */ public CiscLinkedListIterator() { } /** * Returns
{@code true} if the iteration has more elements. (In other words, returns {@code true} if *
{@link #next} would return an element rather than throwing an exception.) * * @return {@code
true} if the iteration has more elements */ @Override public boolean hasNext() { return false; }
/** * Returns the next element in the iteration. * * @return the next element in the iteration *
@throws NoSuchElementException if the iteration has no more elements */ @Override public E
next() { return null; } } }
Note- Can someone help me with the private E get(int index- int curren (1).docx
Ad

More Related Content

Similar to Note- Can someone help me with the private E get(int index- int curren (1).docx (20)

import java.util.Iterator; import java.util.NoSuchElementException; .pdf
  import java.util.Iterator; import java.util.NoSuchElementException; .pdf  import java.util.Iterator; import java.util.NoSuchElementException; .pdf
import java.util.Iterator; import java.util.NoSuchElementException; .pdf
deepakangel
 
For this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdfFor this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdf
fashiongallery1
 
Implementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdfImplementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdf
maheshkumar12354
 
public class MyLinkedListltE extends ComparableltEgtg.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdfpublic class MyLinkedListltE extends ComparableltEgtg.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdf
accostinternational
 
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdfImplement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
rishabjain5053
 
Given below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfGiven below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
info430661
 
we using java dynamicArray package modellinearpub imp.pdf
we using java dynamicArray    package modellinearpub   imp.pdfwe using java dynamicArray    package modellinearpub   imp.pdf
we using java dynamicArray package modellinearpub imp.pdf
adityagupta3310
 
Lecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxLecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docx
SHIVA101531
 
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
Dividing a linked list into two sublists of almost equal sizesa. A.pdfDividing a linked list into two sublists of almost equal sizesa. A.pdf
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
tesmondday29076
 
Implement the following specification of UnsortedType using circular.pdf
Implement the following specification of UnsortedType using circular.pdfImplement the following specification of UnsortedType using circular.pdf
Implement the following specification of UnsortedType using circular.pdf
udit652068
 
package linkedLists- import java-util-Iterator- --- A class representi.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdfpackage linkedLists- import java-util-Iterator- --- A class representi.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdf
arcellzone
 
we using java code DynamicArrayjava Replace all .pdf
we using java code   DynamicArrayjava   Replace all .pdfwe using java code   DynamicArrayjava   Replace all .pdf
we using java code DynamicArrayjava Replace all .pdf
gudduraza28
 
please read the steps below and it will tell you what we usi.pdf
please read the steps below and it will tell you what we usi.pdfplease read the steps below and it will tell you what we usi.pdf
please read the steps below and it will tell you what we usi.pdf
aggarwalopticalsco
 
Describe an algorithm for concatenating two singly linked lists L and.pdf
Describe an algorithm for concatenating two singly linked lists L and.pdfDescribe an algorithm for concatenating two singly linked lists L and.pdf
Describe an algorithm for concatenating two singly linked lists L and.pdf
deepak596396
 
please i need help Im writing a program to test the merge sort alg.pdf
please i need help Im writing a program to test the merge sort alg.pdfplease i need help Im writing a program to test the merge sort alg.pdf
please i need help Im writing a program to test the merge sort alg.pdf
ezonesolutions
 
Java Foundations StackADT-java --- - Defines the interface to a stack.docx
Java Foundations StackADT-java ---  - Defines the interface to a stack.docxJava Foundations StackADT-java ---  - Defines the interface to a stack.docx
Java Foundations StackADT-java --- - Defines the interface to a stack.docx
VictorXUQGloverl
 
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdfLabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
fantasiatheoutofthef
 
A popular implementation of List is ArrayList- Look up how to instanti.pdf
A popular implementation of List is ArrayList- Look up how to instanti.pdfA popular implementation of List is ArrayList- Look up how to instanti.pdf
A popular implementation of List is ArrayList- Look up how to instanti.pdf
arsarees
 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdf
Conint29
 
please read below it will tell you what we are using L.pdf
please read below it will tell you what we are using   L.pdfplease read below it will tell you what we are using   L.pdf
please read below it will tell you what we are using L.pdf
ankit11134
 
import java.util.Iterator; import java.util.NoSuchElementException; .pdf
  import java.util.Iterator; import java.util.NoSuchElementException; .pdf  import java.util.Iterator; import java.util.NoSuchElementException; .pdf
import java.util.Iterator; import java.util.NoSuchElementException; .pdf
deepakangel
 
For this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdfFor this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdf
fashiongallery1
 
Implementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdfImplementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdf
maheshkumar12354
 
public class MyLinkedListltE extends ComparableltEgtg.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdfpublic class MyLinkedListltE extends ComparableltEgtg.pdf
public class MyLinkedListltE extends ComparableltEgtg.pdf
accostinternational
 
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdfImplement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
rishabjain5053
 
Given below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfGiven below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
info430661
 
we using java dynamicArray package modellinearpub imp.pdf
we using java dynamicArray    package modellinearpub   imp.pdfwe using java dynamicArray    package modellinearpub   imp.pdf
we using java dynamicArray package modellinearpub imp.pdf
adityagupta3310
 
Lecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxLecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docx
SHIVA101531
 
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
Dividing a linked list into two sublists of almost equal sizesa. A.pdfDividing a linked list into two sublists of almost equal sizesa. A.pdf
Dividing a linked list into two sublists of almost equal sizesa. A.pdf
tesmondday29076
 
Implement the following specification of UnsortedType using circular.pdf
Implement the following specification of UnsortedType using circular.pdfImplement the following specification of UnsortedType using circular.pdf
Implement the following specification of UnsortedType using circular.pdf
udit652068
 
package linkedLists- import java-util-Iterator- --- A class representi.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdfpackage linkedLists- import java-util-Iterator- --- A class representi.pdf
package linkedLists- import java-util-Iterator- --- A class representi.pdf
arcellzone
 
we using java code DynamicArrayjava Replace all .pdf
we using java code   DynamicArrayjava   Replace all .pdfwe using java code   DynamicArrayjava   Replace all .pdf
we using java code DynamicArrayjava Replace all .pdf
gudduraza28
 
please read the steps below and it will tell you what we usi.pdf
please read the steps below and it will tell you what we usi.pdfplease read the steps below and it will tell you what we usi.pdf
please read the steps below and it will tell you what we usi.pdf
aggarwalopticalsco
 
Describe an algorithm for concatenating two singly linked lists L and.pdf
Describe an algorithm for concatenating two singly linked lists L and.pdfDescribe an algorithm for concatenating two singly linked lists L and.pdf
Describe an algorithm for concatenating two singly linked lists L and.pdf
deepak596396
 
please i need help Im writing a program to test the merge sort alg.pdf
please i need help Im writing a program to test the merge sort alg.pdfplease i need help Im writing a program to test the merge sort alg.pdf
please i need help Im writing a program to test the merge sort alg.pdf
ezonesolutions
 
Java Foundations StackADT-java --- - Defines the interface to a stack.docx
Java Foundations StackADT-java ---  - Defines the interface to a stack.docxJava Foundations StackADT-java ---  - Defines the interface to a stack.docx
Java Foundations StackADT-java --- - Defines the interface to a stack.docx
VictorXUQGloverl
 
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdfLabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
fantasiatheoutofthef
 
A popular implementation of List is ArrayList- Look up how to instanti.pdf
A popular implementation of List is ArrayList- Look up how to instanti.pdfA popular implementation of List is ArrayList- Look up how to instanti.pdf
A popular implementation of List is ArrayList- Look up how to instanti.pdf
arsarees
 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdf
Conint29
 
please read below it will tell you what we are using L.pdf
please read below it will tell you what we are using   L.pdfplease read below it will tell you what we are using   L.pdf
please read below it will tell you what we are using L.pdf
ankit11134
 

More from VictorzH8Bondx (20)

A large bullfrog hops onto a prime spot on log and shoves off a turtle.docx
A large bullfrog hops onto a prime spot on log and shoves off a turtle.docxA large bullfrog hops onto a prime spot on log and shoves off a turtle.docx
A large bullfrog hops onto a prime spot on log and shoves off a turtle.docx
VictorzH8Bondx
 
Passengers arrive at the taxi stand at a Poisson rate of 2 per minute.docx
Passengers arrive at the taxi stand at a Poisson rate of 2 per minute.docxPassengers arrive at the taxi stand at a Poisson rate of 2 per minute.docx
Passengers arrive at the taxi stand at a Poisson rate of 2 per minute.docx
VictorzH8Bondx
 
Pattern recognition is one of the core tasks in data mining- Direction.docx
Pattern recognition is one of the core tasks in data mining- Direction.docxPattern recognition is one of the core tasks in data mining- Direction.docx
Pattern recognition is one of the core tasks in data mining- Direction.docx
VictorzH8Bondx
 
Pathogenesis of yersinia bacteria- And Virulence factors of yersinia.docx
Pathogenesis of yersinia bacteria- And  Virulence factors of yersinia.docxPathogenesis of yersinia bacteria- And  Virulence factors of yersinia.docx
Pathogenesis of yersinia bacteria- And Virulence factors of yersinia.docx
VictorzH8Bondx
 
Pareto Efficiency- clearly provide the following- (1) establish the re.docx
Pareto Efficiency- clearly provide the following- (1) establish the re.docxPareto Efficiency- clearly provide the following- (1) establish the re.docx
Pareto Efficiency- clearly provide the following- (1) establish the re.docx
VictorzH8Bondx
 
Part - Pleace indinate hnu ie the trancartinn afferte the arcnuntinn.docx
Part  - Pleace indinate hnu ie the trancartinn afferte the arcnuntinn.docxPart  - Pleace indinate hnu ie the trancartinn afferte the arcnuntinn.docx
Part - Pleace indinate hnu ie the trancartinn afferte the arcnuntinn.docx
VictorzH8Bondx
 
P90- lbps (Type an integer or a decimal- Do not round-).docx
P90- lbps (Type an integer or a decimal- Do not round-).docxP90- lbps (Type an integer or a decimal- Do not round-).docx
P90- lbps (Type an integer or a decimal- Do not round-).docx
VictorzH8Bondx
 
p2+2pq+q2-1Q4- In a population that is in Hardy-Weinberg equilibrium-.docx
p2+2pq+q2-1Q4- In a population that is in Hardy-Weinberg equilibrium-.docxp2+2pq+q2-1Q4- In a population that is in Hardy-Weinberg equilibrium-.docx
p2+2pq+q2-1Q4- In a population that is in Hardy-Weinberg equilibrium-.docx
VictorzH8Bondx
 
P(X-17)-n-20-p-0-9.docx
P(X-17)-n-20-p-0-9.docxP(X-17)-n-20-p-0-9.docx
P(X-17)-n-20-p-0-9.docx
VictorzH8Bondx
 
P(A)-0-5-P(B)-0-6-P(AB)-0-4- Find P(A union B) a- 0-7 b- 0-6 c- 0-86 d.docx
P(A)-0-5-P(B)-0-6-P(AB)-0-4- Find P(A union B) a- 0-7 b- 0-6 c- 0-86 d.docxP(A)-0-5-P(B)-0-6-P(AB)-0-4- Find P(A union B) a- 0-7 b- 0-6 c- 0-86 d.docx
P(A)-0-5-P(B)-0-6-P(AB)-0-4- Find P(A union B) a- 0-7 b- 0-6 c- 0-86 d.docx
VictorzH8Bondx
 
Over the past few decades of warming- most biological organisms have a.docx
Over the past few decades of warming- most biological organisms have a.docxOver the past few decades of warming- most biological organisms have a.docx
Over the past few decades of warming- most biological organisms have a.docx
VictorzH8Bondx
 
OVERVIEW- In 2001- Troy Stubblefield- the owner of Shreveport Air Tool.docx
OVERVIEW- In 2001- Troy Stubblefield- the owner of Shreveport Air Tool.docxOVERVIEW- In 2001- Troy Stubblefield- the owner of Shreveport Air Tool.docx
OVERVIEW- In 2001- Troy Stubblefield- the owner of Shreveport Air Tool.docx
VictorzH8Bondx
 
Out of Trait- behavioural- relational and contingency approaches of le.docx
Out of Trait- behavioural- relational and contingency approaches of le.docxOut of Trait- behavioural- relational and contingency approaches of le.docx
Out of Trait- behavioural- relational and contingency approaches of le.docx
VictorzH8Bondx
 
Output of electron transport chain (2-2).docx
Output of electron transport chain (2-2).docxOutput of electron transport chain (2-2).docx
Output of electron transport chain (2-2).docx
VictorzH8Bondx
 
Overview Dagnostic coding and reporting guidelines for outpatient serv.docx
Overview Dagnostic coding and reporting guidelines for outpatient serv.docxOverview Dagnostic coding and reporting guidelines for outpatient serv.docx
Overview Dagnostic coding and reporting guidelines for outpatient serv.docx
VictorzH8Bondx
 
out of Stanford University and founded the blood testing company clini.docx
out of Stanford University and founded the blood testing company clini.docxout of Stanford University and founded the blood testing company clini.docx
out of Stanford University and founded the blood testing company clini.docx
VictorzH8Bondx
 
Otosclerosis (abnormal bone growth) of the stapes would cause what kin.docx
Otosclerosis (abnormal bone growth) of the stapes would cause what kin.docxOtosclerosis (abnormal bone growth) of the stapes would cause what kin.docx
Otosclerosis (abnormal bone growth) of the stapes would cause what kin.docx
VictorzH8Bondx
 
Oriole Corporation has outstanding 19-000 shares of $5 par value commo.docx
Oriole Corporation has outstanding 19-000 shares of $5 par value commo.docxOriole Corporation has outstanding 19-000 shares of $5 par value commo.docx
Oriole Corporation has outstanding 19-000 shares of $5 par value commo.docx
VictorzH8Bondx
 
Oriole Marine Products began the year with 10 units of marine floats a.docx
Oriole Marine Products began the year with 10 units of marine floats a.docxOriole Marine Products began the year with 10 units of marine floats a.docx
Oriole Marine Products began the year with 10 units of marine floats a.docx
VictorzH8Bondx
 
Organizations use corporate strategy to select target domains- O.docx
Organizations use corporate strategy to select target domains-      O.docxOrganizations use corporate strategy to select target domains-      O.docx
Organizations use corporate strategy to select target domains- O.docx
VictorzH8Bondx
 
A large bullfrog hops onto a prime spot on log and shoves off a turtle.docx
A large bullfrog hops onto a prime spot on log and shoves off a turtle.docxA large bullfrog hops onto a prime spot on log and shoves off a turtle.docx
A large bullfrog hops onto a prime spot on log and shoves off a turtle.docx
VictorzH8Bondx
 
Passengers arrive at the taxi stand at a Poisson rate of 2 per minute.docx
Passengers arrive at the taxi stand at a Poisson rate of 2 per minute.docxPassengers arrive at the taxi stand at a Poisson rate of 2 per minute.docx
Passengers arrive at the taxi stand at a Poisson rate of 2 per minute.docx
VictorzH8Bondx
 
Pattern recognition is one of the core tasks in data mining- Direction.docx
Pattern recognition is one of the core tasks in data mining- Direction.docxPattern recognition is one of the core tasks in data mining- Direction.docx
Pattern recognition is one of the core tasks in data mining- Direction.docx
VictorzH8Bondx
 
Pathogenesis of yersinia bacteria- And Virulence factors of yersinia.docx
Pathogenesis of yersinia bacteria- And  Virulence factors of yersinia.docxPathogenesis of yersinia bacteria- And  Virulence factors of yersinia.docx
Pathogenesis of yersinia bacteria- And Virulence factors of yersinia.docx
VictorzH8Bondx
 
Pareto Efficiency- clearly provide the following- (1) establish the re.docx
Pareto Efficiency- clearly provide the following- (1) establish the re.docxPareto Efficiency- clearly provide the following- (1) establish the re.docx
Pareto Efficiency- clearly provide the following- (1) establish the re.docx
VictorzH8Bondx
 
Part - Pleace indinate hnu ie the trancartinn afferte the arcnuntinn.docx
Part  - Pleace indinate hnu ie the trancartinn afferte the arcnuntinn.docxPart  - Pleace indinate hnu ie the trancartinn afferte the arcnuntinn.docx
Part - Pleace indinate hnu ie the trancartinn afferte the arcnuntinn.docx
VictorzH8Bondx
 
P90- lbps (Type an integer or a decimal- Do not round-).docx
P90- lbps (Type an integer or a decimal- Do not round-).docxP90- lbps (Type an integer or a decimal- Do not round-).docx
P90- lbps (Type an integer or a decimal- Do not round-).docx
VictorzH8Bondx
 
p2+2pq+q2-1Q4- In a population that is in Hardy-Weinberg equilibrium-.docx
p2+2pq+q2-1Q4- In a population that is in Hardy-Weinberg equilibrium-.docxp2+2pq+q2-1Q4- In a population that is in Hardy-Weinberg equilibrium-.docx
p2+2pq+q2-1Q4- In a population that is in Hardy-Weinberg equilibrium-.docx
VictorzH8Bondx
 
P(X-17)-n-20-p-0-9.docx
P(X-17)-n-20-p-0-9.docxP(X-17)-n-20-p-0-9.docx
P(X-17)-n-20-p-0-9.docx
VictorzH8Bondx
 
P(A)-0-5-P(B)-0-6-P(AB)-0-4- Find P(A union B) a- 0-7 b- 0-6 c- 0-86 d.docx
P(A)-0-5-P(B)-0-6-P(AB)-0-4- Find P(A union B) a- 0-7 b- 0-6 c- 0-86 d.docxP(A)-0-5-P(B)-0-6-P(AB)-0-4- Find P(A union B) a- 0-7 b- 0-6 c- 0-86 d.docx
P(A)-0-5-P(B)-0-6-P(AB)-0-4- Find P(A union B) a- 0-7 b- 0-6 c- 0-86 d.docx
VictorzH8Bondx
 
Over the past few decades of warming- most biological organisms have a.docx
Over the past few decades of warming- most biological organisms have a.docxOver the past few decades of warming- most biological organisms have a.docx
Over the past few decades of warming- most biological organisms have a.docx
VictorzH8Bondx
 
OVERVIEW- In 2001- Troy Stubblefield- the owner of Shreveport Air Tool.docx
OVERVIEW- In 2001- Troy Stubblefield- the owner of Shreveport Air Tool.docxOVERVIEW- In 2001- Troy Stubblefield- the owner of Shreveport Air Tool.docx
OVERVIEW- In 2001- Troy Stubblefield- the owner of Shreveport Air Tool.docx
VictorzH8Bondx
 
Out of Trait- behavioural- relational and contingency approaches of le.docx
Out of Trait- behavioural- relational and contingency approaches of le.docxOut of Trait- behavioural- relational and contingency approaches of le.docx
Out of Trait- behavioural- relational and contingency approaches of le.docx
VictorzH8Bondx
 
Output of electron transport chain (2-2).docx
Output of electron transport chain (2-2).docxOutput of electron transport chain (2-2).docx
Output of electron transport chain (2-2).docx
VictorzH8Bondx
 
Overview Dagnostic coding and reporting guidelines for outpatient serv.docx
Overview Dagnostic coding and reporting guidelines for outpatient serv.docxOverview Dagnostic coding and reporting guidelines for outpatient serv.docx
Overview Dagnostic coding and reporting guidelines for outpatient serv.docx
VictorzH8Bondx
 
out of Stanford University and founded the blood testing company clini.docx
out of Stanford University and founded the blood testing company clini.docxout of Stanford University and founded the blood testing company clini.docx
out of Stanford University and founded the blood testing company clini.docx
VictorzH8Bondx
 
Otosclerosis (abnormal bone growth) of the stapes would cause what kin.docx
Otosclerosis (abnormal bone growth) of the stapes would cause what kin.docxOtosclerosis (abnormal bone growth) of the stapes would cause what kin.docx
Otosclerosis (abnormal bone growth) of the stapes would cause what kin.docx
VictorzH8Bondx
 
Oriole Corporation has outstanding 19-000 shares of $5 par value commo.docx
Oriole Corporation has outstanding 19-000 shares of $5 par value commo.docxOriole Corporation has outstanding 19-000 shares of $5 par value commo.docx
Oriole Corporation has outstanding 19-000 shares of $5 par value commo.docx
VictorzH8Bondx
 
Oriole Marine Products began the year with 10 units of marine floats a.docx
Oriole Marine Products began the year with 10 units of marine floats a.docxOriole Marine Products began the year with 10 units of marine floats a.docx
Oriole Marine Products began the year with 10 units of marine floats a.docx
VictorzH8Bondx
 
Organizations use corporate strategy to select target domains- O.docx
Organizations use corporate strategy to select target domains-      O.docxOrganizations use corporate strategy to select target domains-      O.docx
Organizations use corporate strategy to select target domains- O.docx
VictorzH8Bondx
 
Ad

Recently uploaded (20)

YSPH VMOC Special Report - Measles Outbreak Southwest US 5-14-2025 .pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-14-2025  .pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-14-2025  .pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-14-2025 .pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
The History of Kashmir Lohar Dynasty NEP.ppt
The History of Kashmir Lohar Dynasty NEP.pptThe History of Kashmir Lohar Dynasty NEP.ppt
The History of Kashmir Lohar Dynasty NEP.ppt
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Module_2_Types_and_Approaches_of_Research (2).pptx
Module_2_Types_and_Approaches_of_Research (2).pptxModule_2_Types_and_Approaches_of_Research (2).pptx
Module_2_Types_and_Approaches_of_Research (2).pptx
drroxannekemp
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
Dastur_ul_Amal under Jahangir Key Features.pptx
Dastur_ul_Amal under Jahangir Key Features.pptxDastur_ul_Amal under Jahangir Key Features.pptx
Dastur_ul_Amal under Jahangir Key Features.pptx
omorfaruqkazi
 
Peer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docx
Peer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docxPeer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docx
Peer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docx
19lburrell
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
libbys peer assesment.docx..............
libbys peer assesment.docx..............libbys peer assesment.docx..............
libbys peer assesment.docx..............
19lburrell
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
Aerospace Engineering Homework Help Guide – Expert Support for Academic Success
Aerospace Engineering Homework Help Guide – Expert Support for Academic SuccessAerospace Engineering Homework Help Guide – Expert Support for Academic Success
Aerospace Engineering Homework Help Guide – Expert Support for Academic Success
online college homework help
 
materi 3D Augmented Reality dengan assemblr
materi 3D Augmented Reality dengan assemblrmateri 3D Augmented Reality dengan assemblr
materi 3D Augmented Reality dengan assemblr
fatikhatunnajikhah1
 
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
businessweekghana
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-17-2025 .pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-17-2025  .pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-17-2025  .pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-17-2025 .pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
IPL QUIZ | THE QUIZ CLUB OF PSGCAS | 2025.pdf
IPL QUIZ | THE QUIZ CLUB OF PSGCAS | 2025.pdfIPL QUIZ | THE QUIZ CLUB OF PSGCAS | 2025.pdf
IPL QUIZ | THE QUIZ CLUB OF PSGCAS | 2025.pdf
Quiz Club of PSG College of Arts & Science
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
How to Change Sequence Number in Odoo 18 Sale Order
How to Change Sequence Number in Odoo 18 Sale OrderHow to Change Sequence Number in Odoo 18 Sale Order
How to Change Sequence Number in Odoo 18 Sale Order
Celine George
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Module_2_Types_and_Approaches_of_Research (2).pptx
Module_2_Types_and_Approaches_of_Research (2).pptxModule_2_Types_and_Approaches_of_Research (2).pptx
Module_2_Types_and_Approaches_of_Research (2).pptx
drroxannekemp
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
Dastur_ul_Amal under Jahangir Key Features.pptx
Dastur_ul_Amal under Jahangir Key Features.pptxDastur_ul_Amal under Jahangir Key Features.pptx
Dastur_ul_Amal under Jahangir Key Features.pptx
omorfaruqkazi
 
Peer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docx
Peer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docxPeer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docx
Peer Assessment_ Unit 2 Skills Development for Live Performance - for Libby.docx
19lburrell
 
How to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 PurchaseHow to Manage Amounts in Local Currency in Odoo 18 Purchase
How to Manage Amounts in Local Currency in Odoo 18 Purchase
Celine George
 
libbys peer assesment.docx..............
libbys peer assesment.docx..............libbys peer assesment.docx..............
libbys peer assesment.docx..............
19lburrell
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
Aerospace Engineering Homework Help Guide – Expert Support for Academic Success
Aerospace Engineering Homework Help Guide – Expert Support for Academic SuccessAerospace Engineering Homework Help Guide – Expert Support for Academic Success
Aerospace Engineering Homework Help Guide – Expert Support for Academic Success
online college homework help
 
materi 3D Augmented Reality dengan assemblr
materi 3D Augmented Reality dengan assemblrmateri 3D Augmented Reality dengan assemblr
materi 3D Augmented Reality dengan assemblr
fatikhatunnajikhah1
 
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
UPSA JUDGEMENT.pdfCopyright Infringement: High Court Rules against UPSA: A Wa...
businessweekghana
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
How to Change Sequence Number in Odoo 18 Sale Order
How to Change Sequence Number in Odoo 18 Sale OrderHow to Change Sequence Number in Odoo 18 Sale Order
How to Change Sequence Number in Odoo 18 Sale Order
Celine George
 
Ad

Note- Can someone help me with the private E get(int index- int curren (1).docx

  • 1. Note: Can someone help me with the private E get(int index, int currentIndex, Node n)method. The code is not running. Also I need help with the public void add(int index, E element) method too. Please use the parameters provided with the code to solve. package edu.ust.cisc; import java.util.Iterator; import java.util.NoSuchElementException; public class CiscSortedLinkedList > implements CiscList { /** * A reference to this list's dummy node. Its next reference should refer to the node containing the first element * in this list, or it should refer to itself if the list is empty. The next reference within the node containing * the last element in this list should refer to dummy, thus creating a cyclic list. */ private Node dummy; /** * Number of elements in the list. */ private int size; /** * Constructs an empty CiscSortedLinkedList instance with a non-null dummy node whose next reference refers to * itself. */ public CiscSortedLinkedList() { dummy = new Node<>(null, null); dummy.next = dummy; } /** * Returns the number of elements in this list. * * @return the number of elements in this list */ @Override public int size() { return size; } /** * Returns {@code true} if this list contains no elements. * * @return {@code true} if this list contains no elements */ @Override public boolean isEmpty() { return size==0; } /** * Returns {@code true} if this list contains the specified element (compared using the {@code equals} method). * This implementation should stop searching as soon as it is able to determine that the specified element is not * present. * * @param o element whose presence in this list is to be tested * @return {@code true} if this list contains the specified element * @throws NullPointerException if the specified element is null */ @Override public boolean contains(Object o) { if(o==null){ throw new NullPointerException(); } return containsHelper(o,dummy.next); } private boolean containsHelper(Object o, Node node){ if(node== dummy){ return false; } else if(o.equals(node.data)){ return true; } else{ return containsHelper(o,node.next); } } /** * Returns an iterator over the elements in this list in proper sequence. * * @return an iterator over the elements in this list in proper sequence */ @Override public Iterator iterator() { //return new Iterator (){ //private Node curr = dummy.next; //private Node prev = dummy; //private boolean canRemove = false; return null; } /** * Returns an array containing all of the elements in this list in proper sequence (from first to last element). * The returned array will be "safe" in that no references to it are maintained by this list. (In other words, * this method must allocate a new array even if this list is backed by an array). The caller is thus free to modify * the returned array. * * @return an array containing all of the elements in this list in proper sequence */ @Override public Object[] toArray() { Object[] arr = new Object[size]; int i = 0; for(Node current = dummy;current!=null;current= current.next){ arr[i++] = current.data; } return arr; } /** * {@link #toArray} recursive helper method. Adds the element contained in the specified node to the specified index * in the specified array. Recursion stops when the specified node is the dummy node. * * @param arr the array into which each element in this list should be added * @param index the index into which the next element in this list should be added * @param n the node containing the next element in this list to add to the array */ private void toArray(Object[] arr, int index, Node n) { } /** * Adds the specified element to its sorted location in this list. * * Lists may place the specified element at arbitrary locations if desired. In particular, an ordered list will * insert the specified element at its sorted location. List classes should clearly specify in their documentation * how elements will be added to the list if different from the default behavior (end of this list). * * @param value element to be added to this list * @return {@code true} * @throws NullPointerException if the specified element is null */ @Override public
  • 2. boolean add(E value) { return false; } /** * {@link #add} recursive helper method. Adds the specified value to the list in a new node following the specified * node (if that is the appropriate location in the list). * * @param value element to be added to this list * @param n a reference to the node possibly prior to the one created by this method */ private void add(E value, Node n) { } /** * Removes the first occurrence of the specified element from this list, if it is present. If this list does not * contain the element, it is unchanged. Returns {@code true} if this list contained the specified element. This * implementation should stop searching as soon as it is able to determine that the specified element is not * present. * * @param o element to be removed from this list, if present * @return {@code true} if this list contained the specified element * @throws NullPointerException if the specified element is null */ @Override public boolean remove(Object o) { if(o==null){ throw new NullPointerException(); } Node curr = dummy.next; Node prev = dummy; while (curr != dummy && !o.equals(curr.data)) { prev = curr; curr = curr.next; } if (curr == dummy) { return false; } else { System.out.println("Removing Data:"+curr.data); prev.next = curr.next; size--; return true; } } /** * {@link #remove} recursive helper method. Removes the node following n if it contains the specified element. This * implementation should stop searching as soon as it is able to determine that the specified element is not * present. * * @param o element to be removed from this list, if present * @param n a reference to the node prior to the one possibly containing the value to remove * @return */ private boolean remove(Object o, Node n) { return false; } /** * Removes all of the elements from this list. The list will be empty after this call returns. @Override public void clear() { dummy.next=dummy; size=0; } /** * Returns the element at the specified position in this list. * * @param index index of the element to return * @return the element at the specified position in this list * @throws IndexOutOfBoundsException if the index is out of range */ @Override public E get(int index) { if(index<0 || index>=size){ throw new IndexOutOfBoundsException(); } Node curr = dummy.next; for(int i=0;i n) { if(index<0 || index>=size){ throw new IndexOutOfBoundsException(); } Node curr = head; for(int i=0;i next_curr=curr.next; curr.next=n; while(n.next) { n = n.next; //finding end of n headed linked list n.next = next_curr;//adding rest linked list at end of n headed linked list } if(index==0) { return n; } else { return head; } } /** * * @param index index of the element to replace * @param element element to be stored at the specified position * @return the element previously at the specified position * @throws UnsupportedOperationException if the {@code set} operation is not supported by this list */ @Override public E set(int index, E element) { throw new UnsupportedOperationException(); } /** * This operation is not supported by CiscSortedLinkedList. * * @param index index at which the specified element is to be inserted * @param element element to be inserted * @throws UnsupportedOperationException if the {@code set} operation is not supported by this list */ @Override public void add(int index, E element) { } /** * Appends all elements in the specified list to the end of this list, in the order that they are returned by the * specified list's iterator. * * @param c list containing elements to be added to this list * @return {@code true} if this list changed as a result of the call * @throws NullPointerException if the specified list is null */ @Override public boolean addAll(CiscList extends E> c) { return false; } /** * Removes the element at the specified position in this list. Shifts any subsequent elements to the left * (subtracts one from their indices). Returns the element that was removed from the list. * * @param index the index of the element to be removed * @return the element previously at the specified position * @throws IndexOutOfBoundsException if the index is out of range */ @Override public E remove(int index) { return null; } /** * {@link #remove} recursive helper method. Removes the node
  • 3. following n if it contains the element at the specified * index. * * @param index the index of the element to be removed * @param currentIndex the index of the node parameter * @param n the node containing the element at currentIndex * @return */ private E remove(int index, int currentIndex, Node n) { return null; } /** * Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not * contain the element (compared using the {@code equals} method). This implementation should stop searching as * soon as it is able to determine that the specified element is not present. * @param o element to search for * @return the index of the first occurrence of the specified element in this list, or -1 if this list does not * contain the element * @throws NullPointerException if the specified element is null */ @Override public int indexOf(Object o) { if(o==null){ throw new NullPointerException(); } return indexOf(o,0, dummy.next); } /** * {@link #indexOf} recursive helper method. Returns currentIndex if the element contained in the node parameter is * equal to the specified element to search for. This implementation should stop searching as soon as it is able to * determine that the specified element is not present. * * @param o element to search for * @param currentIndex the index of the node parameter * @param n the node containing the element at currentIndex * @return the index of the first occurrence of the specified element in this list, or -1 if this list does not * contain the element */ private int indexOf(Object o, int currentIndex, Node n) { if(n.data.equals(o)){ return currentIndex; } else if(n==dummy){ return -1; } else if(n.data.compareTo((E)o)>0){ return -1; } else{ return indexOf(o,currentIndex+1,n.next); } } /** * Returns a string representation of this list. This string should consist of a comma separated list of values * contained in this list, in order, surrounded by square brackets (examples: [3, 6, 7] and []). * * @return a string representation of this list */ public String toString() { return null; } /** * {@link #toString} recursive helper method. Returns a string representation of this list, beginning with the * element in the specified node * * @param n the node containing the next element to append to the string * @return a string representation of this list, beginning with the element in the specified node */ private String toString(Node n) { return null; } private static class Node { private E data; private Node next; private Node(E data, Node next) { this.data = data; this.next = next; } } private class CiscLinkedListIterator implements Iterator { /** * A reference to the node containing the next element to return, or to the dummy node if there are no more * elements to return. */ private Node nextNode; /** * Constructs an iterator ready to return the first element in the list (if present). */ public CiscLinkedListIterator() { } /** * Returns {@code true} if the iteration has more elements. (In other words, returns {@code true} if * {@link #next} would return an element rather than throwing an exception.) * * @return {@code true} if the iteration has more elements */ @Override public boolean hasNext() { return false; } /** * Returns the next element in the iteration. * * @return the next element in the iteration * @throws NoSuchElementException if the iteration has no more elements */ @Override public E next() { return null; } } }
  翻译: