String Matching

Table of contents:

Projects

13.10

Write a program which takes two command-line arguments: a pattern and a file to search. The program should print out each line in the file in which the pattern occurs. Hint: Look at the code from the Anagrams constructor (Figure 11-7) to see how to read from a file.

13.11

The string matching problem is more difficult if the pattern may contain wild cards. A wild card is a character that can match any character in the text. For example, the pattern "de?er", with '?' as a wild card, matches both "defer" and "deter".

Modify the comments for AbstractStringMatcher to allow the use of the character '?' as a wild card. Modify two of the subclasses to provide this functionality. Explain why this would be difficult for the other subclass.


Part I: Object-Oriented Programming

Encapsulation

Polymorphism

Inheritance

Part II: Linear Structures

Stacks and Queues

Array-Based Structures

Linked Structures

Part III: Algorithms

Analysis of Algorithms

Searching and Sorting

Recursion

Part IV: Trees and Sets

Trees

Sets

Part V: Advanced Topics

Advanced Linear Structures

Strings

Advanced Trees

Graphs

Memory Management

Out to the Disk

Part VI: Appendices

A. Review of Java

B. Unified Modeling Language

C. Summation Formulae

D. Further Reading

Index



Data Structures and Algorithms in Java
Data Structures and Algorithms in Java
ISBN: 0131469142
EAN: 2147483647
Year: 2004
Pages: 216
Authors: Peter Drake

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net