Note:
1)|| is a doubly link in the above
2)test it in main
3)Try not to make any global declarations if possible
TASK:
Write program using linked list implementation and implement the following link list :
a->Apple->Ali
||
b->Bored->Bat
||
c->Cat->Cow
// a linked list
#include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* next;
};
int main()
{
Node* head = NULL;
Node* second = NULL;
// allocate 2 nodes in the heap
head = new Node();
second = new Node();
head->data = apple; // assign data in first node
head->next = Alli
Comments
Leave a comment