DATA STRUCTURE http://www.youtube.com/c/EDULINEFORCS
STUDENT
MODULE 3
LINKED LIST & MEMORY
MANAGEMENT
Prepared By Mr. EBIN PM, AP, IESCE 1
SELF REFERENTIAL STRUCTURE
• Self Referential Structure is the Data Structure in which the pointer
refers (points) to the structure of the same type.
• In other words, structures pointing to the same type of structures
are self-referential in nature.
• A self referential structure is used to create data structures like
linked lists, tree, graph etc.
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 2
Prepared By Mr. EBIN PM, AP, IESCE
,DATA STRUCTURE http://www.youtube.com/c/EDULINEFORCS
STUDENT
Eg: In singly linked list
• In the above declaration next is the pointer to the structure of type
node. Here next is the pointer which will contains the address of
the structure of the same type (i.e address of next node) and data
will contain the actual data.
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 3
Eg: In Doubly linked list
• In the above declaration prev & next are the pointer to the
structure of type node. Here prev pointer contains the address of
the previous node and next pointer contains the address of the
next node.
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 4
Prepared By Mr. EBIN PM, AP, IESCE
, DATA STRUCTURE http://www.youtube.com/c/EDULINEFORCS
STUDENT
DYNAMIC MEMORY ALLOCATION
Memory Allocation Process
• Global variables, static variables and program instructions get their
memory in permanent storage area whereas local variables are
stored in a memory area called Stack.
• The memory space between these two region is known as Heap
area. This region is used for dynamic memory allocation during
execution of the program. The size of heap keep changing.
• The process of allocating memory at runtime is known as dynamic
memory allocation. Library routines known as memory
management functions are used for allocating and freeing memory
during execution of a program.
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 5
Program memory layout
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 6
Prepared By Mr. EBIN PM, AP, IESCE
STUDENT
MODULE 3
LINKED LIST & MEMORY
MANAGEMENT
Prepared By Mr. EBIN PM, AP, IESCE 1
SELF REFERENTIAL STRUCTURE
• Self Referential Structure is the Data Structure in which the pointer
refers (points) to the structure of the same type.
• In other words, structures pointing to the same type of structures
are self-referential in nature.
• A self referential structure is used to create data structures like
linked lists, tree, graph etc.
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 2
Prepared By Mr. EBIN PM, AP, IESCE
,DATA STRUCTURE http://www.youtube.com/c/EDULINEFORCS
STUDENT
Eg: In singly linked list
• In the above declaration next is the pointer to the structure of type
node. Here next is the pointer which will contains the address of
the structure of the same type (i.e address of next node) and data
will contain the actual data.
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 3
Eg: In Doubly linked list
• In the above declaration prev & next are the pointer to the
structure of type node. Here prev pointer contains the address of
the previous node and next pointer contains the address of the
next node.
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 4
Prepared By Mr. EBIN PM, AP, IESCE
, DATA STRUCTURE http://www.youtube.com/c/EDULINEFORCS
STUDENT
DYNAMIC MEMORY ALLOCATION
Memory Allocation Process
• Global variables, static variables and program instructions get their
memory in permanent storage area whereas local variables are
stored in a memory area called Stack.
• The memory space between these two region is known as Heap
area. This region is used for dynamic memory allocation during
execution of the program. The size of heap keep changing.
• The process of allocating memory at runtime is known as dynamic
memory allocation. Library routines known as memory
management functions are used for allocating and freeing memory
during execution of a program.
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 5
Program memory layout
Prepared By Mr.EBIN PM, AP, IESCE EDULINE 6
Prepared By Mr. EBIN PM, AP, IESCE