Posts

Singly Linked List

  Singly Linked list is a type of Linked List Data structure which behaves like a  one way list/chain . The reason it is called a one way list or one way chain is because we can only  traverse this list in one direction , start from the head node to the end. Following are the standard Singly Linked List Operations – Traverse  – Iterate through the nodes in the linked list starting from the head node. Append  – Attach a new node (to the end) of a list Prepend  – Attach a new node (to the beginning) of the list Insert  – attach a new node to a specific position on the list Delete  – Remove/Delink a node from the list Count  – Returns the no of nodes in linked list C++ Program to Implement Singly Linked List – #include<iostream> using namespace std; class Node { public: int key; int data; Node * next; Node() { key = 0; data = 0; next = NULL; } Node(int k, int d) { key = k; data = d; } }; class Sing...
Recent posts