//Zachary Fitzsimmons
import java.util.LinkedList;
public class Num21
{
public int countZeroes(ListNode head)
{
int count;
for(ListNode node = head; node.getNext() != null; node = node.getNext())
if(node.getValue() == 1)
count++;
return count;
}
}
//Zachary Fitzsimmons
import java.util.LinkedList;
public class MyLinkedList
{
private ListNode head;
public void remove(Object obj)
{
for(ListNode node = head; node.getNext().getNext() != null; node = node.getNext())
if(node.getNext().getValue().equals(obj))
node.setNext(node.getNext().getNext());
}
}
/**
* Write a description of class Iterator here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Iterator
{
// instance variables - replace the example below with your own
private int x;
/**
* Constructor for objects of class Iterator
*/
public Iterator()
{
// initialise instance variables
x = 0;
}
/**
* An example of a method - replace this comment with your own
*
* @param y a sample parameter for a method
* @return the sum of x and y
*/
public int sampleMethod(int y)
{
// put your code here
return x + y;
}
}
//Zachary Fitzsimmons
import java.util.LinkedList;
public class MyDoubleLinkedList
{
private LIstNode2 head, tail;
public Object removeFirst()
{
if(head == tail)
throw UnsupportedOperationException();
Object temp;
ListNode2 node = head;
temp = node.getValue();
node.setNext(node.getNext().GetNext());
node = node.getNext().getNext();
node.setPrevious(node.getPrevious().getPrevious());
return temp;
}
}
//Zachary Fitzsimmons
import java.util.LinkedList;
public class Num25
{
public void fixBackLinks()
{
}
}
//ZAchary Fitzsimmons
import java.util.LinkedList;
public class MyDoublyLInkedListWithHeader
{
private ListNode2 header;
public void insertInOrder(Integer x);
}