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

Linked list algorithms in Pseudo code Class Linked List Data: head-Pointer to No

ID: 3586876 • Letter: L

Question

Linked list algorithms in Pseudo code Class Linked List Data: head-Pointer to Node that will hold the head pointer of the list Len: number of Nodes in the linked list Default constructor Linked list- will be called when linked list is created (Usually done in automatic memory) head-NULL len = 0 Member function insert node (data) input: data to be inserted into linked list (stored in Node) output: None returns: Nothing ptr = allocate a new Node (Put data in node) prev= NULL curr- head while (curr != NULL and curr->data

Explanation / Answer

#include<iostream>
using namespace std;
struct Node
{
int data;
Node *link;

};
class LinkList
{
Node *head;
public:
LinkList()
{
head=NULL;

len=0;
ptr=allocate a new node;
prev=curr;
curr=currlink;

}

void insert_node(data)
{
Node *newNode;
newNode = new Node;
newNode ->link =NULL;
newNode ->data = val;
newNode ->link=headptr;
head = newNode;
}

void Display()
{
Node *disNode;
disNode = headptr;
while(curr !=NULL and cur->data < data)
{
prev=curr
curr = curr link
cout<<"Display Node Value is "<<disNode ->data<<endl<<endl;
  
}

if {
prev=NULL
put link=head;
head= ptr;
}
else
{
put link= prev link;
prev link =ptr;
len=len+1;
}

};
};
void main()
{
LinkList lobj;
lobj.InsertatFirst(45);
lobj.InsertatFirst(2);
lobj.InsertatFirst(1);
lobj.InsertatFirst(0);
lobj.InsertatFirst(-1);
lobj.Display();
}

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