Introduction to linked List
Memory is very crucial data source in our system we do n't have
unlimited memory in a computer system fine so it is a responsibility of a
memory manager to manage this resource. Memory manager will allocate
how many bytes 3 into 4 that is 2 any bytes fine so let us suppose one
complete block of 12 bytes has been allocated suppose from 102 from
hundred to this one one one this is free. In advance the programmer told
that I want size for only three integers so he has allocated 12 bytes now
what a memory manager will say he 'll say I can not extend the size of
your area because I have already allocated that that consecutive block to
some other variable. Memory is not free the memory manager can not
allocate this free memory to another variable but this programmer is not
using that memory so this is what the wastage of memory is there.
Linked lists is also a collection of elements and arrays were also a
collections of elements. The only difference is this data items are not
storing consecutive locations because this in area these are stored in
consecutive location continuous location. some cases then fresh a block
of 452 452 elements how many bytes 52 into 4 so 2 0 8 bytes would be
allocated a new block of to 0 8 byte would be.
The memory manager will allocate space for all the five variables some
fresh block would be allocated no why so because these values are not
not in contiguous locations so if anywhere space is available for 8 bytes
then memory manager can allocate space they are only fine and we can
provide space. Link to link into this node for that new node inserted but
in array we can not do this because in array drobik is what all the value
should be in consecutive locations. In case of linked list cygnus here this
particular node is containing two values and type of two values so is
different one is integer value and this one is what address. man two
members are there one is this one one one and this one now why I am
writing here struct node as you know if you want to declare a pointer
which is going to store address of some another integer variable. If you
know this this this address 1 0 2 if you know the value of this head this
pointer they can then you can easily reverse this linked list fine.
A linked list is a linear data structure it is a collection of data elements
which are stored in known consecutive locations. Accessing of any
elements will take order of 1 only constant time fine here insertion is
easy and deletion is also easy why so because see if sorted air is there
like this see. take order of n time complexity and in array it is order of 1
only next point you can say binary search is not possible in linked list. In
next video I am going to discuss the basic operations of this linked list
traversal insertion deletion something like this with the help of their
code.