Answered step by step
Verified Expert Solution
Question
1 Approved Answer
#include #include using namespace std; struct node { int data; node * next; } ; void insertN ( node * &head, node * &displayPtr, int
#include
#include
using namespace std;
struct node
int data;
node next;
;
void insertNnode &head, node &displayPtr, int data
node pnode;
pnode new node;
ifpnode NULL
cout"Unable to locate node"data data;
pnodenext NULL;
ifhead NULL && displayPtr NULL
head pnode;
displayPtr pnode;
else
headnext pnode;
head pnode;
void displayNnode displayPtr
node ptr displayPtr;
while ptr NULL
cout ptrdata;
if ptrnext NULL
cout ;
ptr ptrnext;
cout endl;
return;
int main
node head NULL;
node displayPtr NULL;
insertNhead displayPtr, ;
insertNhead displayPtr, ;
insertNhead displayPtr, ;
cout"Nodes in linked list."
Step 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