Self-referential data structures are useful in applications that involve linked data structures such as lists, trees and graphs. One structure will represent one component of the list. Each component of the list is called a node. The self-referential pointer indicates where the next component is located. Thus it links one component of list with another.
struct emp identifies a structure consisting of two members, an integer and a pointer (next) to another structure of same type. ‘start’ is an external pointer to struct emp. It will indicate the beginning of linked list.
Pointer to next node is assigned a value of NULL until next node is created.
All operations on linked list, i.e. changing order of nodes, adding nodes, deleting nodes etc. can be done easily since only the pointer has to be altered.
There are several different kinds of linked data structures.
Linear linked list : In this components are linked together in sequential manner.
Doubly linked list : Here multiple pointers permit forward and backward traversal within the list.
Circular linked list : In which the last node points to the first node.
Trees : Here components are arranged hierarchically.
Here we will study linear linked lists.
Representation of linked list
Since 3rd node is the last node, NULL value is assigned to next node pointer. Thus NULL detects end of list.
Implementing list operations
Whatever be the application which uses linklist, the basic operations are creating a node, insertion of a node, deleting a node and displaying the list. Here we explain the operations and write a function for each of them. At the end we write a program that combines all the operations on a list.
C Related Interview Questions
|DBMS Interview Questions||C++ Interview Questions|
|C & Data Structures Interview Questions||Java Interview Questions|
|Go (programming language) Interview Questions||F Sharp (programming language) Interview Questions|
|C preprocessor Interview Questions||R Programming language Interview Questions|
|D Programming Language Interview Questions||Lua (programming language) Interview Questions|
|Embedded C Interview Questions|
Introduction To C-programming
Data Types And Storage Classes
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.