4 Pages

prog3

Course: CS 225, Fall 2009
School: Boise State
Rating:
 
 
 
 
 

Word Count: 919

Document Preview

Science Computer 225 Laboratory Assignment #3 Spring 2006 DUE DATE: 6 April, 2006 LEARNING OBJECTIVES: In completing this assignment, each student will learn how to manipulate simple linked data structures. get experience implementing iterators. DESCRIPTION: The above objective will be realized using a simple type of linked list called a self organizing list which tends to keep the most frequently referenced...

Register Now

Unformatted Document Excerpt

Coursehero >> Idaho >> Boise State >> CS 225

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Science Computer 225 Laboratory Assignment #3 Spring 2006 DUE DATE: 6 April, 2006 LEARNING OBJECTIVES: In completing this assignment, each student will learn how to manipulate simple linked data structures. get experience implementing iterators. DESCRIPTION: The above objective will be realized using a simple type of linked list called a self organizing list which tends to keep the most frequently referenced elements near the front of the list. Under certain conditions, the operations on a long list might have reasonable expected performance (there are generally much better approaches, however). The following interface is provided as the basis for a class SOList. Your class must implement the following interface in creating and manipulating this special type linked list. Your list iterator should be a fail fast iterator. import java.util.Iterator; /** * This interface provides an abstraction for a self-organizing * list which has the following properties: * -- Additions are made to the front of the list. * -- If a "find" operation succeeds, the associated * element is placed at the front of the list; * the order of the remaining elements does not change. */ public interface SOListInterface<T> { /** * The following method should add the new element * to the front of the list. * * @param obj -- the data object to be added. */ public void add(T obj); /** * Returns the first element from the list. * * @returns the data object from the first cell. * @throws NoSuchElementException if the list is empty. */ public T get(); /** * The remove() method removes the first element * of the list. This method normally follows * an application of a successful find operation. * * @return the data member associated with the * first cell. * @throws NoSuchElementException if the list * is empty. */ public T remove(); /** * The following method returns the data member * of a cell or null if the object is not in * the list. If present, the method moves the * the cell to the front of the list before * returning the value. * * @param obj -- the data value to match (via * equals). */ public T find(T obj); /** * Returns the number of elements in the list. */ public int size(); /** * The iterator() method returns an Iterator. * * @return an Iterator for the list. * */ public Iterator<T> iterator(); } Copy the les SOListInterface.java and SOListTester.java from the assignment directory (~stark/cs225/prog3) and implement the above interface. In addition, you are to implement the Cloneable interface and provide a clone() method which does a shallow copy (it does not attempt to clone the data members). implement the cell structure of your linked list (should be singly linked) using a private inner class Node. override the toString() method to return a string representation of the contents the of elements in the list. If elem1 is the rst element in the list, elem2 is the second element, and so on, then the string that toString returns should be constructed as follows: elem1.toString() + "\n" + elem2.toString() + "\n" + ... + elemN.toString() + "\n" where elemN is the last element in the list. Do NOT put any other characters in this string, as we will be using a string comparison to insure that your program has everything in the correct order. Grading Issues Unlike the previous two assignments, style and documentation will be a signicant portion in the grading of this assignment. Refer to the Style Guide for further information. Submit your program from onyx from a directory containing only the relevant les using: submit stark cs225 3 Suggestions As noted above, you will need a Node class to represent the list nodes, which needs to be a private class dened inside your SOList class. Besides privacy, structure, and encapsulation, there is an important reason to do it this way: inside the SOList<T> class the parameterized type T is known. Because of this, elds of the internal Node class can have type T, but the Node class itself does not have to be (and should not be) generic. In fact, if you do something like class Node<T> { ... } that T actually refers to a different generic type than that of the SOList class! For the iterator, you will need a second (private) interior class that implements the Iterator interface. In particular it must implement the hasNext, next, and remove methods. Dont be surprised if it takes you longer to implement this iterator than all the other methods in the SOList. As with your Node class, ...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Boise State - CS - 464
COMPSCI 464/564 Programming Assignment #1Assigned: 9/18/2006 Due: 9/25/2006 For this assignment, you will implement all the declared but undefined member functions in the vector2d class that is partially defined in the file vector2d.H, which is loca
Boise State - CS - 225
COMPSCI 225-001 Programming AssignmentDue: Tuesday, Dec. 4, 2007IntroductionThis assignment asks you to construct a Java program that evaluates numerical expressions in either postx or inx notation. In doing so, you will gain experience using sta
Boise State - CS - 125
Chapter 1: Computer SystemsPresentation slides forJava Software SolutionsFoundations of Program DesignThird Edition by John Lewis and William LoftusJava Software Solutions is published by Addison-WesleyPresentation slides are copyright 2002 b
Boise State - CS - 253
'$FiltersA filter performs some kind of transformation on an input file to create the output. head, grep, tail, uniq select part of the file sort changes the order of the lines in the file pr, fmt reformat the file tr, awk, sed selectively
Boise State - CS - 253
'$The make utilityInformation sources Managing Projects with make by Andrew Oram and Steve Talbot (an O'Reilly book) http:/www.delorie.com/gnu/docs/make/make_toc.html the man page man make&amp;%'$What is make? make is a utility that c
Boise State - CS - 253
COMPSCI 253: Object-Oriented Program Development in C2 semester credits MW 11:40-12:30 in MEC 206Instructor: Teresa ColeOce Phone email MEC 302L 426-2485 tcole@onyx.boisestate.eduOce HoursMonday Tuesday Wednesday Thursday 12:30 1:15 8:30 9:0
Boise State - CS - 253
Software Tool UsageName: Indicate which tools you used during the semester as well as how comfortable you feel about using them Used in Class Frequently Occasionally Eclipse Other IDE (name) Never Future Use Would Use if needed CommentsMake Valgri
Boise State - CS - 253
'Object Oriented C and Linux$These are notes for COMPSCI 253 (Object Oriented C and Linux). The notes assume that you have done about two semesters of object-oriented Java programming. The notes also rely on your owning the book &quot;The C programm
Boise State - CS - 221
'$The make utilityInformation sources Managing Projects with make by Andrew Oram and Steve Talbot (an OReilly book) http:/www.delorie.com/gnu/docs/make/make_toc.html the man page man make&amp;%'$What is make make is a utility that com
Boise State - CS - 125
Solutions to Quick Check Questions5Selection Statements5.1The if Statement1.Identify the invalid if statements:a. if ( a &lt; b ) then x = y; else x = z; c. if ( a &lt; b ) x = y; else { x = z; }; if ( a &lt; b ) { x = y; } else x = z;b.if (
Boise State - CS - 125
Solutions to Quick Check Questions6Repetition Statements6.1The while Statement1.Write a while statement to add numbers 11 through 20. Is this a countcontrolled or sentinel-controlled loop?int sum = 0, i = 11; while ( i &lt;= 20 ) { /this is
Stanford - EE - 398
EE398A Project PresentationsSessionsTuesday, March 13, 2:15-4:30 p.m., Packard 202 Thursday, March 15, 2:15-4:30 p.m., Packard 202Presentation time (hard limit):15 minutes Schedule has been sent out by emailBernd Girod: EE398A Image Communicati
Stanford - EE - 398
Lossy compressionGoal: Lower the bit-rate R by introducing some (acceptable) distortion D of the signal X. Rate RLossless codingD=0 R H (X )Distortion DBernd Girod: EE398A Image Communication I Rate Distortion Theory no. 1Topics in lossy co
Stanford - EE - 398
Predictive CodingLossless predictive coding Optimum nonlinear and linear predictors JPEG-LS lossless compression standard Lossy predictive coding: DPCM Rate distortion performance of DPCM Transmission errors in predictive codingBernd Girod: EE398A
Stanford - AIIRCS - 223
Trajectory GenerationBasic Problem: Move the manipulator arm from some initial position {TA} to some desired final position {TC}. (May be going through some via point {TB}){TA} {TB} Path points : Initial, final and via points Trajectory : Time hist
Stanford - CS - 242
CS 242Some Course Goals Programming LanguagesProgramming Language Concepts A language is a conceptual universe (Perlis) Framework for problem-solving Useful concepts and programming methodsJohn Mitchell Understand the languages you use, by
Stanford - CS - 242
CS 242Some Course Goals Programming Language Concepts A language is a &quot;conceptual universe&quot; (Perlis) Framework for problemsolving Useful concepts and programming methods Programming LanguagesJohn Mitchell Understand the languages you use,
Stanford - CS - 106
Eric Roberts CS106AHandout #26 October 18, 1999String OperationsReminder: Graphics contest entries due Wednesday at 5:00 P.M. In many ways, the most important general concept to understand about strings is that they function as an abstract data
Stanford - CS - 106
Eric Roberts CS106AHandout #24 October 15, 1999Enumeration Types and CharactersReading: today, Chapter 9 Monday and Wednesday, Chapter 10 The principle of enumeration The idea that it is possible to represent values like days of the week, compas
Stanford - CS - 106
Eric Roberts CS106AHandout #15 October 4, 1999Notes on Control Statements in CReading: Today, Chapter 4 Wednesday, Chapter 5 Topics not covered in class The following topics from Chapter 4 are important, but will not be covered explicitly in cla
Stanford - CS - 106
Eric Roberts CS106AHandout #20 October 8, 1999CS106A Graphics ContestSubmission deadline: Wednesday, October 20 The graphics programs you can write using the tools from Chapter 7 are more exciting than some of the other programs you have seen in
Stanford - CS - 106
Eric Roberts CS106AHandout #39 November 1, 1999Assignment #5MiniSimDue: Monday, November 8 Although the MiniSim machine provides a useful model for thinking about computer architecture, it doesnt exist in the physical sense. When you use the Min
Stanford - E - 145
E145/STS173 Session 2 Silicon Valley and EntrepreneurshipProfessor Randy Komisar Stanford UniversityCopyright 2006 by the Board of Trustees of the Leland Stanford Junior University and Stanford Technology Ventures Program (STVP). This document ma
Stanford - BRKS - 1036
UNTIED STATES DISTRICT COUR T FOR THE DISTRICT OF MASSACHUSETT S' i sf~'CMARK COLLINS, Derivatively on Behalf ) Civil Action No . of Nominal Defendant BROOKS ) AUTOMATION, INC ., )_~ t} jA Plaintiff,v.I))RROBERT J . THERRIEN, A .
Stanford - CPN - 1023
Stanford - MU - 1035
IN THE UNITED STATES DISTRICT COURT FOR THE DISTRICT OF IDAHO In re MICRON TECHNOLOGIES, INC. SECURITIES LITIGATION ) 1 Case No. CV-06-85-S-BLW MEMORANDUM DECISION AND ORDER INTRODUCTION The Court has before it a motion for class certification filed
Stanford - STA - 1039
UNITED STATES DISTRICT COURT DISTRICT OF MINNESOTA SIDNEY KAHN, on behalf of himself and all others similarly situated, Plaintiff, v. THE ST. PAUL TRAVELERS COMPANIES, INC., ROBERT LIPP, JAY FISHMAN, BRUCE A BACKBERG, THOMAS A. BRADLEY, JOHN C. TREAC
Stanford - CSUN - 1038
UNITED STATES DISTRICT COURT SOUTHERN DISTRICT OF NEW YORKANTHONY GIOMBETTI and DON VANDENHEUVAL, Individually and On Behalf of All Others Similarly Situated, Plaintiffs, vs. CHINA SUNERGY CO. LTD., Defendant.x : : : : : : : : : : : xCivil Acti
Stanford - XIDE - 1034
Patrick L. Rocco (PR 8621) SHALOV STONE &amp; BONNER LLP 163 Madison Avenue, P.O. Box 1277 Morristown, New Jersey 07962-1277 Tel.: (973) 775-8997 MILBERG WEISS BERSHAD &amp; SCHULMAN LLP Steven G. Schulman Peter E. Seidman Sharon M. Lee One Pennsylvania Plaz
Stanford - QSFT - 1037
UNITED STATES DISTRICT COURT CENTRAL DISTRICT OF,CALIFORNIA PHTLLIP ENG, Derivatively On Behalf of QUEST SOFTWARE, INC.PLAINTIFF(S) v~C 4.SE NUMBERSACV06-751 DOC(RNBx )SEE ATTACHEDSUMMON S 1EPNDANT(S) .TO : THE ABOVE-NAMED DEFENDANT(S) : Y
Stanford - FHRX - 1025
Case 1:02-cv-02332-JOFDocument 68Filed 09/29/2004Page 1 of 37IN THE UNITED STATES DISTRICT COURT FOR THE NORTHERN DISTRICT OF GEORGIA ATLANTA DIVISIONIN RE FIRST HORIZON PHARMACEUTICAL CORPORATION SECURITIES LITIGATION: : : : : :CIVIL A