The text edited by a line editor is represented by a doubly linked list of nodes, each

Question:

The text edited by a line editor is represented by a doubly linked list of nodes, each of which contains an 80-column line of text

(type LineType). There is one external pointer (type LineType*)

to this list, which points to the “current” line in the text being edited. The list has a header node, which contains the string “- –

– Top of File – – -” and a trailer node, which contains the string “- – – Bottom of File – – -”. 1. Draw a sketch of this data structure. 2. Write the type declarations to support this data structure. 3. Write the class constructor, which sets up the header and trailer nodes. 4. Code the following operations:

GoToTop(LineType* linePtr)

image text in transcribed

image text in transcribed 5. Describe the operations in part

(d) in terms of Big-O notation. How could you change the list to make these operations O(1)? 6. Code the InsertLine operation, using the following specification:

InsertLine(LinePtrType linePtr, LineType newLine) 5. Describe the operations in part

(d) in terms of Big-O notation. How could you change the list to make these operations O(1)? 6. Code the InsertLine operation, using the following specification:

InsertLine(LinePtrType linePtr, LineType newLine)

image text in transcribed7. What other member functions should be included?

Step by Step Answer:

Related Book For  book-img-for-question

C++ Plus Data Structures

ISBN: 9781284089189

6th Edition

Authors: Nell Dale, Chip Weems, Tim Richards

Question Posted: