# Linear data structure

thais article describe data structure

# Linear Data Structure

In arrays the elements are stored sequentially and we can have sequential as well as random access to the elements .But major drawback of arrays is that once the elements are stored sequentially, it becomes very difficult to insert the element in between or to delete the middle element.Because for insertion of new element in between, the other elements should be shifted down or otherwise if we delete any elenemt from array the vacant space will get created in the array and we do not desire such a vacant space in between .

Another drawback of array data structure is that we can not have the exact judgement about the array sixe. In handling this dat astructure somethimes the memory may get wasted or there may be a case in whichwe have to increase the areay sixe. So to soleve the sbove mentioned probvelms we will learn a new data strucrture i.e.linked list .With linked organixation as you will notice later that insertions and deletions can be efficiently carried out.

Suppose that the items of a stack or a queue were explicitly ordered, that is , each item containned within itself the address of the next item, such an explicit ordering gives rise to a dat astructure which is known as linear linked list or singluy linked list. Each item in the lost is called a node and contains two fields, an information field and a next address field.
the information field holds the actual elementsof the lost . The next address of a particular node, in knwn as a pointer(which stores address fof next node). The entire linked lost is accessed from an external pointer start that points to cntains the address of )the first node in the list .(by an "external"pointer, we mean one that is not includewithin a node, rather its
valure can be accessed directly by referencing a variable.) The next address field of the last noddein the lost contains a special value, known as NULL, which is not a valid address . This NULL pointer is used to signal the end of a list.

List with no nodes is called an empty list or NULL list

** DYNAMIC MENORY MANAGEMENT **
In computer world the two words 'static'and 'dynamic' have gerat importance. the static refers to an activity which is carried out at the time of compilation of a program and before execution of the program where as dynamic means the activity carried out while the programs executed.Here we are going to see what is static and dynamic menory at compilation time while the word dynamic refers to allocation/deallocating of memory while program is running (after compilation).The advantage of dynamic memory management in handling the linked list is that we can create as many nodes as we desire and if some nodes are not required we can decollate (free)them. Such a deallocated memory can be reallocated for some other nodes.Thus the total memory utilization is possible.