Posts

Showing posts from September 22, 2019

Linked List(single)

Image
Linked List(single) Code:(simple creating nodes and display it) #include <iostream> using namespace std; struct node {     int data;     node *next; }; class linked_list { private:     node *head,*tail; public:     linked_list()     {         head = NULL;         tail = NULL;     }     void add_node(int n)     {         node *tmp = new node;         tmp->data = n;         tmp->next = NULL;         if(head == NULL)         {             head = tmp;             tail = tmp;         }         else         {             tail->next = tmp; ...