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

I need help to finish this program there are few codes that I have to add thanks

ID: 3621131 • Letter: I

Question

I need help to finish this program there are few codes that I have to add thanks:

// This is the implementation file for the method that inserts an item in
// sorted order into a list for a ListClass object.

#include "inlab6.h"
#include "structs.h"

#include <iostream>
#include <fstream>
#include <stdlib.h>
using namespace std;

// This function appends the record 'newData' into the sorted position of the linked list.
// If the list is empty, the new node is the new head of the list.
void ListClass::insertInOrder(RecordType newData)
// INOUT IN
{
NodePtrType newNode, prev,current;//pointers to the new node and for
//traversing the list

// Create a new node to hold the record. Be sure to put
// the data from newData into the newNode.
Replace this with the code necessary to create a new node to hold
the record.
NodePtrType *current;
current= newNode;
//The following code should do the following:
//if (expression to check if the list is empty)
//{
// code to make the new node the head of the list
//}
Replace this with the code:
if (current != NULL)
{
currnet= current->next;
}

//The following code should do the following:
//else if (expression to check if the new acctNum is less than the head accNum)
//{
// code to make the new node the head of the list
//}
Replace this with the code:
else if (current < prev)
{
//code to make the new node the head of the list
current= head;
}

else
{
// put the new node where it belongs.

Replace this with the code necessary to traverse the list and find the
correct location for the new node to go.


Replace this with the code necessary to insert the new node into the list

}
}//end of insertInOrder function

Explanation / Answer

#ifndef LISTNODE_H #define LISTNODE_H template class List; template class ListNode { friend class List; public: ListNode(const NODETYPE &); NODETYPE getData() const; void setNextPtr(ListNode *nptr) { nextPtr = nPtr; } ListNode *getNextPtr() const { return nextPtr; } private: NODETYPE data; ListNode *nextPtr; }; template ListNode::list() :firstptr(0),lastptr(0) { } template List::~List() { if(!isEmpty()) { cout nextPtr; lastPtr = currentPtr; currentPtr ->nextPtr = 0; } value = temPtr -> data; delete tempPtr; return true; } } template bool List::isEmpty()const { return firstPtr == 0; } template ListNode *List::getNewNode( const NODETYPE & value) { return new ListNode (value); } template void List::print() const { if(isEmpty()) { cout getData(); previousPtr -> setNextPtr (currentPtr -> getNextPtr()); delete tempPtr; return true; } }while(currentPtr != lastPtr); return false; } } template bool List ::deleteNodeByLocation( NODETYPE & deletedValue, int location) { int count =1 ; if( isEmpty()) return false; if(location < 0) return false; else if(location == 0) return removeFromFront(deletedValue); ListNode * currentPtr = firstPtr -> nextPtr, *previousPtr = firstPtr; while(count nextPtr; count++; } } ListNode *tempPtr = currentPtr; deletedValue = currentPtr -> getData(); prevoiousPtr -> setNextPtr *(cuurentPtr -> getNextPtr()); delte tempPtr; return true; } #endif #include using std::cout; using std::cin; #include using std::random_access_iterator_tag; using std::srand; using std::srand; #include using std::time; #include "List.h" int main() { srand(time(0)); ListintList; for (int i=0;i
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