Question
Implement class my str again, this time using a singly linked list for its representation. Note, your class my str will only have one data
Implement class my str again, this time using a singly linked list for its representation.
Note, your class my str will only have one data member, called head, which is a pointer to a list node. head should be private. You must not add any other data members (specifically do not add a length counter or a tail pointer). list node is a low-level class that has only two public data members, info, of type character, and next of type pointer to list node. Pay careful attention to memory management. Do not share memory across my str objects. Feel free to add additional definitions, but please do not add any more data members to class my str (such as the length of the list). Length, for example, should compute the length by counting the number of elements. Please use iteration (looping) to implement all the list methods and functions this time around.
// For my.str, N is the number of characters in this my_str private: static int length(list_node 1) // 0(N) public: int length) / O(N) 1/. ..calls the length function aboveStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started