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)

Function: Postcondition: Goes to the top of the list. currentLine is set

to access the first line of text. 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?

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 Expert Approved Answer
Step: 1 Unlock

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

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Language Pragmatics Questions!