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
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)

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)
7. What other member functions should be included?
Function: Postcondition: Goes to the top of the list. currentLine is set to access the first line of text.
Step by Step Solution
3.36 Rating (159 Votes )
There are 3 Steps involved in it
1 Draw a sketch of this data structure Ans Here is a sketch representing the doubly linked list structure for the text editor with each node containing an 80column line of text The structure includes ... View full answer
Get step-by-step solutions from verified subject matter experts
