Essay Samples

HOME F.A.Q. REGISTER LOGIN SEARCH  
Essay Topics
Acceptance
Art
Business
Custom Written
Direct Essays
English
Example Essays
Foreign
History
Medical
Mega Essays
Miscellaneous
Movies
Music
Novels
People
Politics
Pre-Written
Religion
Science
Search
Speeches
Sports
Technology
Over 101,000 Essays and Term Papers!!

Featured Papers from RadEssays

1. Java vs c
2. Java Programming
3. Java for Databases
4. Java
5. Java
This is only a preview of the paper
Click here to register and get the full text.
Existing members click here to login

Java

1. Complete the implementation of the following method, observing the following restrictions: Ć you don't declare any additional local variables or allocate new objects. Ć you don't store null in the Queue or Stack. Ć neither StackInterface or QueueInterface has a size method (but they do have isEmpty methods) Answer: public static void purge(QueueInterface q) { // pre: q is not null, q contains only Integer objects // post: all negative Integers are removed from q, // order of other elements in q remains unchanged StackInterface s = DataFactory.makeStack(); //Check if the values of the Integer objects in q are negative or positive. If positive, put //them into stack s and remove from q. Otherwise, remove from q only. while (q.isEmpty() = = false) { if (q.peek.intValue( ) < 0) { q.dequeue( ); } else { s.push (q.dequeue( )); } } //Put back all positive integer objects into q, but in a reverse order. while (s.isEmpty( ) = = false) { q.enqueue(s.pop); } //Put the integer objects into q in the original order. while (q.isEmpty( ) = = false) { s.push (q.dequeue( )); } while (s.isEmpty( ) = = false) { q.enqueue(s.pop); } } 2. Consider the following interface. public interface ExtendedStack extends StackInterface { public Object pull(); // pre: this is not empty // post: the item on the bottom of the stack (the item first in) // is removed and returned } Here are three suggested classes that could implement this ADT: public class SinglyLinkedExtendedStack implements ExtendedStack {// Implementation using a singly-linked list private Node head; private int count; ...


Approximate Word count = 1039
Approximate Pages = 4.2
(250 words per page double spaced)
Over 101,000 Essays and Term Papers!!
Links
java technology

Macbeth

Java

java technology

History of JAVA

Macbeth

Support
F.A.Q.
Custom Essays
Payment
Essay Samples
Forgot Password?
Activation Email
More Links
All Papers Are For Research And Reference Purposes Only! You may not turn these papers in as your own! You must cite our web site as your source!
Copyright 2003-2008 essaysamples.net. All rights reserved.