Group Activity - Move Names

A linked list contains nodes described by the boxed declaration. The nodes are in alphabetical order by name. Write a function that removes from the list all names that begin with a letter in the range from Start to End, inclusive, and that sets M as a pointer to the list of removed nodes.

     struct NodeType
          apstring name;
          NodeType * next;

     void MoveNames(NodeType * & L, char Start, char End, NodeType * & M)
     // pre:  L points to a non-empty list of alphabetized names; M is empty;
     //       letter Start <= letter End
     // post: the names in the range of Start..End have been moved from list L 
     //       to list M; both lists maintain alphabetical order

Continue to:  Unit 6  / Prev  / Next