

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Project #3 for cs 331, due on october 13, 2004. Students are required to implement the abstract data type (adt) character string using a linked list of characters. Correspondences between adt list operations and java's linkedlist methods, instructions for creating the adt character string, and key concepts for the operations. Students must write a java client program to test the adt operations.
Typology: Study Guides, Projects, Research
1 / 2
This page cannot be seen from the preview
Don't miss anything!
CS 331 Project #3 Oct. 4, 2004
Page 1 of 2
Due at start of class on Wednesday, Oct. 13, 2004 50 points.
Refer to Exercise 5, page 210, textbook.
A referenced-based implementation of the ADT list was discussed (pages 176 to 180, Textbook) Class java.util.LinkedList implements the List interface. The correspondences between ADT List and class java.util.LinkedList are as below:
ADT List operations (^) java.util.LinkedList methods createList() LinkedList^ () LinkedList (Collection c) isEmpty() isEmpty () size() size () add(index, item) add (int index, Object element) addFirst (Object o) addLast (Object o) addAll (Collection c) addAll (int index, Collection c) remove(index) remove^ (int index) removeFirst () removeLast () remove(item) remove^ ( Object^ o) removeAll() clear () removeRange (int fromIndex, int toIndex) get(index) get (int index) getFirst () getLast () locateIndex(item) indexOf^ (Object o) lastIndexOf () replace(index, newItem) set (int index, Object element) subList (int fromIndex, int toIndex) equals (Object o) containsAll (Collection c) iterator() listIterator (int index)
Implement the ADT character string by using a linked list of characters. Include typical operations such as append one string to another, extract a substring, find the index of the leftmost occurrence of a character in a string, determine whether one string is a substring of another. determine whether two strings are identical to each other.
CS 331 Project #3 Oct. 4, 2004
Page 2 of 2
Key concepts of ADT character string operations
The class for the ADT character string has to include the following: Define a StringNode class (page 163, Textbook) Declare head, prev, curr reference variables and a size variable Define a method append(string1, string2) Define a method extract(fromPosition) Define a method extract(fromPosition, toPosition) Define a method find(character) Define a method isSubstring(string1, string2)
Implementing above ADT using Java. Write a Java client program which uses above ADT operations to do: (10 points each)
a. appending one string to another, b. extracting a substring, c. finding the index of the leftmost occurrence of a character in a string, d. determining whether one string is a substring of another e. determining whether two strings are identical to each other.