Question: in C++ the text edited by a line editor (class LineEd) is represented by a doubly linked list of nodes, each of which contains an
in C++ the text edited by a line editor (class LineEd) is represented by a doubly linked list of nodes, each of which contains an 80-column line of text (type Line). There is one external pointer (type Line *) to this list, which points to the current line in the text being edited. The list has a header node, which contains the C-string - - - Top of File - - - and a trailer node, which contains the C-string - - - Bottom of File - - -.
a. Sketch this data structure.
b. Give the class declaration - write the type declarations to support this data structure along with the basic insertLine() and deleteLine(), include member functions goToTop() and goToBottom().
c. Design and code the class constructor (sets up the header and trailer nodes) and destructor.
d. Design and code the goToTop() and goToBottom() functions.
e. Describe the operations goToTop() and goToBottom() in terms of Big-O. If they are not O(1), state how we could change the list to make these operations O(1).
f. Design and code the insertLine() and deleteLine() functions.
g. Test your LineEd class.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
