Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

To pointer-based list class, add the following methods: 1) insert_B– inserts at

ID: 3618839 • Letter: T

Question

To pointer-based list class, add the following methods:

1)      insert_B– inserts at end, dupes allowed

2)      insert_C– inserts at end, dupes not allowed

3)      insert_E– insert in sorted order.

4)      aBoolean search function, returns trueif value is in the list, else false

5)      aBoolean ascending order function,returns true if values are in sorted order

6)      afunction reverse, which outputs thedata values in reverse order.


Here is my code that I have with the header file first...


//----- List.h -----
#ifndef LINKEDLIST
#define LINKEDLIST
#include <iostream>
using namespace std;

typedef int ElementType;


class List
{

private:

class Node
{
public:
//------ Node DATA MEMBERS
ElementType data;
Node * next;

//------ Node OPERATIONS
//-- Default constructor: initializes next member to
Node()
: next(0)
{ }
//-- Explicit-value constructor: initializes data member to dataValue
//-- and next member to 0
Node(ElementType dataValue)
: data(dataValue), next(0)
{ }

}; //--- end of Node class

typedef Node * NodePointer;

public:
//------ List OPERATIONS
List();
/*--------------------------------------------------------------------
Default constructor: builds an empty List object.
Precondition: None
Postcondition: first is 0 and mySize is 0.
--------------------------------------------------------------------*/

List(const List & origList);
/*--------------------------------------------------------------------
Copy constructor
Precondition: A copy of origList is needed.
Postcondition: A distincr copy of origList has been constructed.
--------------------------------------------------------------------*/

~List();
/*--------------------------------------------------------------------
Destructor
Precondition: This list's lifetime is over.
Postcondition: This list has been destroyed.
--------------------------------------------------------------------*/

const List & operator=(const List & rightSide);
/*--------------------------------------------------------------------
Assignment operator
Precondition: This list must be assigned a value.
Postcondition: A copy of rightSide has been assigned to this list.
--------------------------------------------------------------------*/

bool List::empty();
/*--------------------------------------------------------------------
Check if this list is empty
Precondition: None.
Postcondition: true is returned if this list is empty, false if not.
--------------------------------------------------------------------*/

void insert_A(ElementType dataVal, int index);
/*--------------------------------------------------------------------
Insert a value into a list at a given index.
Precondition: index is a valid list index: 0 <= index <= mySize,
Postcondition: dataVal has been inserted into the list at position
index, provided index is valid..
--------------------------------------------------------------------*/

void insert_B(ElementType dataVal);
/*--------------------------------------------------------------------
Insert a value into a list at the end of the list.
Precondition: memory for new node/value is available.
Postcondition: dataVal has been added to the end of the list
--------------------------------------------------------------------*/

void insert_C(ElementType dataVal);
/*--------------------------------------------------------------------
Insert a value into a list if it's not already there.
Precondition: memory for new node/value is available.
Postcondition: dataVal is on the list
--------------------------------------------------------------------*/

void insert_D(ElementType dataVal);
/*--------------------------------------------------------------------
Insert a value into a list if it's not already there.
Precondition: memory for new node/value is available.
Postcondition: dataVal is on the list.
Calls node_search to see if dataval is on list
--------------------------------------------------------------------*/

void insert_E(ElementType dataVal);
/*--------------------------------------------------------------------
Insert a value into a list in sorted order, if it's not already there.
Precondition: memory for new node/value is available.
Postcondition: dataVal is on the list.

--------------------------------------------------------------------*/

void erase(int index);
/*--------------------------------------------------------------------
Remove a value from a list at a given index.
Precondition: index is a valid list index: 0 <= index < mySize
Postcondition: dataVal at list position index has been removed,
provided index is valid.
--------------------------------------------------------------------*/

int search_A(ElementType dataVal);
/*--------------------------------------------------------------------
Search for an data value in this list.
Precondition: None
Postcondition: Index of node containing dataVal is returned
if such a node is found, -1 if not.
--------------------------------------------------------------------*/

//List::NodePointer search_B(ElementType dataVal);
List search_B(ElementType dataVal);
/*--------------------------------------------------------------------
Search for an data value in this list.
Precondition: None
Postcondition: List containing dataVal is returned
if such a node is found, 0 if not.
--------------------------------------------------------------------*/

//bool List::node_search_B(ElementType dataVal);
/*--------------------------------------------------------------------
Search for an data value in this list.
Precondition: None
Postcondition: True (1) is returned, 0 if not.
--------------------------------------------------------------------*/

void display(ostream & out) const;
/*--------------------------------------------------------------------
Display the contensts of this list.
Precondition: ostream out is open
Postcondition: Elements of this list have been output to out.
--------------------------------------------------------------------*/

int nodeCount();
/*-------------------

Explanation / Answer

anyone have anything....I really am not sure how to start on this and now my deadline is only a couple hours away

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote