12.07.2015 Views

A Practical Introduction to Data Structures and Algorithm Analysis

A Practical Introduction to Data Structures and Algorithm Analysis

A Practical Introduction to Data Structures and Algorithm Analysis

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Sec. 4.5 Further Reading 1474.5 Further ReadingFor more discussion on choice of functions used <strong>to</strong> define the List ADT, see thework of the Reusable Software Research Group from Ohio State. Their definitionfor the List ADT can be found in [SWH93]. More information about designingsuch classes can be found in [SW94].4.6 Exercises4.1 Assume a list has the following configuration:〈 | 2, 23, 15, 5, 9 〉.Write a series of Java statements using the List ADT of Figure 4.1 <strong>to</strong> deletethe element with value 15.4.2 Show the list configuration resulting from each series of list operations usingthe List ADT of Figure 4.1. Assume that lists L1 <strong>and</strong> L2 are empty at thebeginning of each series. Show where the current position is in the list.(a) L1.append(10);L1.append(20);L1.append(15);(b) L2.append(10);L2.append(20);L2.append(15);L2.moveToStart();L2.insert(39);L2.next();L2.insert(12);4.3 Write a series of Java statements that uses the List ADT of Figure 4.1 <strong>to</strong>create a list capable of holding twenty elements <strong>and</strong> which actually s<strong>to</strong>res thelist with the following configuration:〈 2, 23 | 15, 5, 9 〉.4.4 Using the list ADT of Figure 4.1, write a function <strong>to</strong> interchange the currentelement <strong>and</strong> the one following it.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!