View the step-by-step solution to:

#ifndef EC_LIST_FUNCS_H #define EC_LIST_FUNCS_H #include <iostream> #include <string> // Node type used for lists struct Node { int data; Node *next;...

#ifndef EC_LIST_FUNCS_H

#define EC_LIST_FUNCS_H


#include <iostream>

#include <string>


// Node type used for lists

struct Node {

  int data;

  Node *next;


  Node(int item);

  Node(int item, Node *n);

};



typedef Node * ListType;


/*

 * split

 *

 * PRE: list is a well-formed list

 *

 * Splits list into two sub-lists as follows: "a" will contain all the

 * elements up to, but not including, the first occurrence of splitVal

 * in the original list. And "b" will contain all the elements after

 * splitVal in the original list. Otherwise the values in the new

 * lists will be in the same order as in the original list. If

 * splitVal does not appear in list, all the elements will be in "a",

 * and "b" will be NULL.

 *

 * This operation will destroy the list, because it reuses nodes from the

 * original list. After the operation, list will be NULL.

 *

 * NOTE: this function does not create any nodes, but reuses

 * nodes from the original list.

 *

 * Examples:

 *

 * list       splitVal a      b

 * (7 4 2 3 9) 2      (7 4)  (3 9)

 * (7 4 2 3 9) 7      ()     (4 2 3 9)

 * (1 2 3 3 2) 3      (1 2)  (3 2)

 * ()          3      ()     ()

 * (7 5)       3      (7 5)  ()

 * (7 2 3)     3      (7 2)  ()

 * (3)         3      ()     ()

 */

void split(ListType &list, int splitVal, ListType &a, ListType &b);





How can I implement the split functionjQuery2240014732694986007155_1543715664574???? please help!!!!

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question