This blog is under construction

Sunday 24 February 2013

Linked List


Linked list is a data structure consists of series of nodes.  Each node consists a data and a pointer to the next node.  And the reference from the last node points to NULL.  And it can be used to implement stacks, queue, etc.

Structure of a node:
struct node {
int data;
struct node *ptr;
};

                              ..................................
                             |      data       |       ptr       |
                              ..................................
                                                node

Basic Operations In Linked List:
insert()       - insert a new node into the linked list
delete()      - delete a node from the linked list
isEmpty()    - List is empty or not
isFirst()       - given data is in first node of linked list or not
isLast()       - given data is at the last node or not
first()         - gets the data in first node
last()          - gets the data in last node
deleteList() - delete entire list

Types of Linked List:
1.  Singly Linked List
2.  Doubly Linked List
3.  Circular Linked List

See Also:


No comments:

Post a Comment