the standard template library provides rather different data structure called list the stl (standard template librarylist provides only those operations that can be implemented efficiently in list implementation known as doubly linkedwhich we shall study shortly in particularthe stl list does not allow random access to an arbitrary list positionas provided by our list operations for insertionremovalretrievaland replacement another stl template classcalled vectordoes provide some random access to sequence of data values an stl vector bears some similarity to our list adtin particularit provides the operations that can be implemented efficiently in the list implementation that we shall call contiguous in this wayour study of the list adt provides an introduction to the stl classes list and vector notes concept of linked lists an array is represented in memory using sequential mappingwhich has the property that elements are fixed distance apart but this has the following disadvantage it makes insertion or deletion at any arbitrary position in an array costly operationbecause this involves the movement of some of the existing elements when we want to represent several lists by using arrays of varying sizeeither we have to represent each list using separate array of maximum size or we have to represent each of the lists using one single array the first one will lead to wastage of storageand the second will involve lot of data movement so we have to use an alternative representation to overcome these disadvantages one alternative is linked representation in linked representationit is not necessary that the elements be at fixed distance apart insteadwe can place elements anywhere in memorybut to make it part of the same listan element is required to be linked with previous element of the list this can be done by storing the address of the next element in the previous element itself this requires that every element be capable of holding the data as well as the address of the next element thus every element must be structure with minimum of two fieldsone for holding the data valuewhich we call data fieldand the other for holding the address of the next elementwhich we call link field thereforea linked list is list of elements in which the elements of the list can be placed anywhere in memoryand these elements are linked with each other using an explicit link fieldthat isby storing the address of the next element in the link field of the previous element this program uses strategy of inserting node in an existing list to get the list created an insert function is used for this the insert function takes pointer to an existing list as the first parameterand data value with which the new node is to be created as second parametercreates new node by using the data valueappends it to the end of the listand returns pointer to the first node of the list initially the list is emptyso the pointer to the starting node is null thereforewhen insert is called first timethe new node created by the insert becomes the start node subsequentlythe insert traverses the list to get the pointer to the last node of the existing listand puts the address of the newly created node in the link field of the last nodethereby appending the new node to the existing list the main function reads the value of the number of nodes in the list calls iterate that many times by going in while loop to create the links with the specified number of nodes representation of linked list because each node of an element contains two partswe have to represent each node through structure lovely professional university