FastQueue and InClass Implementation: Completing dequeue and lessThan Methods, Assignments of Computer Science

The implementation details of the fastqueue and inclass classes in java. The in-class activity instructions for students to complete the dequeue method in the fastqueue class with the precondition that the queue is not empty, and complete the lessthan method in the inclass class to return the number of elements less than the given argument. The document also includes junit test cases for the countnumberlessthan method.

Typology: Assignments

Pre 2010

Uploaded on 08/31/2009

koofers-user-l9m-1
koofers-user-l9m-1 🇺🇸

5

(1)

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
C Sc 227 In-Class Activity
Form teams of two, choose the scribe as the person who hasn't started MineSweeper (flip a coin on
a tie or negotiate), complete dequeue below with the precondition that the queue is not empty,
and write both names here:
1. _______________________________ 2. ______________________________________
public class FastQueue<E> implements GenericQueue<E> {
private class Node {
private E data;
private Node next;
public Node(E element) {
data = element;
next = null;
}
}
private Node front;
private Node back;
public FastQueue() {
front = back = null;
}
// Complete dequeue
// Precondition: The queue is not empty
public E dequeue()
pf3

Partial preview of the text

Download FastQueue and InClass Implementation: Completing dequeue and lessThan Methods and more Assignments Computer Science in PDF only on Docsity!

C Sc 227 In-Class Activity

Form teams of two, choose the scribe as the person who hasn't started MineSweeper (flip a coin on

a tie or negotiate), complete dequeue below with the precondition that the queue is not empty,

and write both names here:

1. _______________________________ 2. ______________________________________

public class FastQueue implements GenericQueue { private class Node { private E data; private Node next; public Node(E element) { data = element; next = null; } } private Node front; private Node back; public FastQueue() { front = back = null; } // Complete dequeue // Precondition: The queue is not empty public E dequeue()

  • See other side for question