Created
July 7, 2018 16:33
-
-
Save miladabc/116592360a657ace7695811c646fa940 to your computer and use it in GitHub Desktop.
Head Node Linked List
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Milad Abbasi | |
//06-07-2018 | |
//Head Node Linked List | |
#include <iostream> | |
using namespace std; | |
struct Node | |
{ | |
int data; | |
Node *next; | |
}; | |
class HeaderLinkedList | |
{ | |
Node *head; | |
public: | |
HeaderLinkedList() | |
{ | |
head = new Node; | |
head->next = NULL; | |
} | |
void insertStart(int value) | |
{ | |
Node *tmp = new Node; | |
tmp->data = value; | |
tmp->next = head; | |
head = tmp; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment