SlideShare a Scribd company logo
1 of 16
DATA STRUCTURES AND LINKED LISTS
IN C
DATA STRUCTURES IN C
• The data structure name indicates itself that organizing the data in
memory.
• There are many ways of organizing the data in the memory as we have
already seen one of the data structures, i.e., array in C language.
• It is a set of algorithms that we can use in any programming language
to structure the data in the memory.
TYPES
TYPES
• Primitive Data structure
The primitive data structures are primitive data types.
The int, char, float, double, and pointer are the primitive data structures
that can hold a single value.
• Non-Primitive Data structure
The non-primitive data structure is divided into two types:
1. Linear data structure
2. Non-linear data structure
TYPES
• Linear data structure
1. The arrangement of data in a sequential manner is known as a linear data
structure.
2. The data structures used for this purpose are Arrays, Linked list, Stacks, and
Queues.
3. In these data structures, one element is connected to only one another element
in a linear form.
• Non-linear data structure
1. When one element is connected to the 'n' number of elements known as a
non-linear data structure.
2. The best example is trees and graphs.
3. In this case, the elements are arranged in a random manner.
TYPES
• Data structures can also be classified as:
1. Static data structure: It is a type of data structure where the size is
allocated at the compile time. Therefore, the maximum size is fixed.
However, the values of the elements stored are not static and can be
modified at any time. Example - Array.
2. Dynamic data structure: It is a type of data structure where the
size is allocated at the run time. Therefore, the maximum size is
flexible. Example - Linked List.
OPERATIONS ON DATA STRUCTURES
• Searching: We can search for any element in a data structure.
• Sorting: We can sort the elements of a data structure either in an
ascending or descending order.
• Insertion: We can also insert the new element in a data structure.
• Update: We can also update the element, i.e., we can replace the
element with another element.
• Deletion: We can also perform the delete operation to remove the
element from the data structure.
LINKED LISTS
• Like arrays, Linked List is a linear data structure.
• Unlike arrays, linked list elements are not stored at a contiguous
location; the elements are linked using pointers.
• They includes a series of connected nodes.
• Here, each node stores the data and the address of the next node.
USES
• The list is not required to be contiguously present in the memory. The
node can reside any where in the memory and linked together to make
a list. This achieves optimized utilization of space.
• list size is limited to the memory size and doesn't need to be declared
in advance.
• Empty node can not be present in the linked list.
• We can store values of primitive types or objects in the singly linked
list.
SINGLY LINKED LIST
• Singly linked list can be defined as the collection of ordered set of
elements.
• The number of elements may vary according to need of the program.
• A node in the singly linked list consist of two parts: data part and link
part.
• Data part of the node stores actual information that is to be represented
by the node while the link part of the node stores the address of its
immediate successor.
• One way chain or singly linked list can be traversed only in one
direction.
DOUBLY LINKED LIST
• Doubly linked list is a complex type of linked list in which a node
contains a pointer to the previous as well as the next node in the
sequence.
• Therefore, in a doubly linked list, a node consists of three parts: node
data, pointer to the next node in sequence (next pointer) , pointer to the
previous node (previous pointer).
• The prev part of the first node and the next part of the last node will
always contain null indicating end in each direction.
• Due to the fact that, each node of the list contains the address of its
previous node
CIRCULAR LINKED LIST
• In a circular Singly linked list, the last node of the list contains a
pointer to the first node of the list.
• We can have circular singly linked list as well as circular doubly
linked list.
• We traverse a circular singly linked list until we reach the same node
where we started.
• The circular singly liked list has no beginning and no ending. There is
no null value present in the next part of any of the nodes.
CIRCULAR DOUBLY LINKED LIST
• Circular doubly linked list is a more complexed type of data structure
in which a node contain pointers to its previous node as well as the
next node.
• Circular doubly linked list doesn't contain NULL in any of the node.
• The last node of the list contains the address of the first node of the
list.
• The first node of the list also contain address of the last node in its
previous pointer
INSERTING A NODE
• A node can be added in three ways
1. At the front of the linked list
2. After a given node.
3. At the end of the linked list.
DELETING A NODE
• Delete from Beginning: Point head to the next node i.e. second node
head = head->next
• Delete from end: Point head to the previous element i.e. last second
element.
Change next pointer to null
struct node*temp = head;
while(temp->next->next!=NULL)
{
temp = temp->next
}
temp->next = NULL
DELETING A NODE
• Delete from Middle: Traverse to element before the element to be
deleted
Change next pointer to exclude the node from the chain
for(int i=2; i< position; i++)
{
if(temp->next!=NULL)
{
temp = temp->next;
}
}
temp->next = temp->next->next;

More Related Content

Similar to DATA STRUCTURES AND LINKED LISTS IN C.pptx

1.Introduction to Data Structures and Algorithms.pptx
1.Introduction to Data Structures and Algorithms.pptx1.Introduction to Data Structures and Algorithms.pptx
1.Introduction to Data Structures and Algorithms.pptxBlueSwede
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
mbit_Unit-2_Linked List.pptx
mbit_Unit-2_Linked List.pptxmbit_Unit-2_Linked List.pptx
mbit_Unit-2_Linked List.pptxjotaro11
 
Linear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueLinear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueSelvaraj Seerangan
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm KristinaBorooah
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power pMeghaKulkarni27
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked listsAbdullah Al-hazmy
 
LINKED LIST.pptx
LINKED LIST.pptxLINKED LIST.pptx
LINKED LIST.pptxDr.Shweta
 
Unit 1 linked list
Unit 1 linked listUnit 1 linked list
Unit 1 linked listLavanyaJ28
 
DS Module 03.pdf
DS Module 03.pdfDS Module 03.pdf
DS Module 03.pdfSonaPathak5
 
Unit 2 linear data structures
Unit 2   linear data structuresUnit 2   linear data structures
Unit 2 linear data structuresSenthil Murugan
 
Introduction to Data Structures and Linked List
Introduction to Data Structures and Linked ListIntroduction to Data Structures and Linked List
Introduction to Data Structures and Linked ListSelvaraj Seerangan
 

Similar to DATA STRUCTURES AND LINKED LISTS IN C.pptx (20)

unit 1.pptx
unit 1.pptxunit 1.pptx
unit 1.pptx
 
Linked list (1).pptx
Linked list (1).pptxLinked list (1).pptx
Linked list (1).pptx
 
1.Introduction to Data Structures and Algorithms.pptx
1.Introduction to Data Structures and Algorithms.pptx1.Introduction to Data Structures and Algorithms.pptx
1.Introduction to Data Structures and Algorithms.pptx
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
2- link-list.ppt
2- link-list.ppt2- link-list.ppt
2- link-list.ppt
 
Link_List.pptx
Link_List.pptxLink_List.pptx
Link_List.pptx
 
mbit_Unit-2_Linked List.pptx
mbit_Unit-2_Linked List.pptxmbit_Unit-2_Linked List.pptx
mbit_Unit-2_Linked List.pptx
 
Linear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and QueueLinear Data Structures - List, Stack and Queue
Linear Data Structures - List, Stack and Queue
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
linked list.pptx
linked list.pptxlinked list.pptx
linked list.pptx
 
Linkedlists
LinkedlistsLinkedlists
Linkedlists
 
Data Structures- Part7 linked lists
Data Structures- Part7 linked listsData Structures- Part7 linked lists
Data Structures- Part7 linked lists
 
LINKED LIST.pptx
LINKED LIST.pptxLINKED LIST.pptx
LINKED LIST.pptx
 
Unit 1 linked list
Unit 1 linked listUnit 1 linked list
Unit 1 linked list
 
DS Module 03.pdf
DS Module 03.pdfDS Module 03.pdf
DS Module 03.pdf
 
Unit 2 linear data structures
Unit 2   linear data structuresUnit 2   linear data structures
Unit 2 linear data structures
 
Introduction to Data Structures and Linked List
Introduction to Data Structures and Linked ListIntroduction to Data Structures and Linked List
Introduction to Data Structures and Linked List
 
Unit 1.ppt
Unit 1.pptUnit 1.ppt
Unit 1.ppt
 
Data Structures 3
Data Structures 3Data Structures 3
Data Structures 3
 

More from SKUP1

serial_busses_i2c.pptx
serial_busses_i2c.pptxserial_busses_i2c.pptx
serial_busses_i2c.pptxSKUP1
 
DESIGN PATTERN.pptx
DESIGN PATTERN.pptxDESIGN PATTERN.pptx
DESIGN PATTERN.pptxSKUP1
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxSKUP1
 
C-Programming File-handling-C.pptx
C-Programming  File-handling-C.pptxC-Programming  File-handling-C.pptx
C-Programming File-handling-C.pptxSKUP1
 
Processes, Threads.pptx
Processes, Threads.pptxProcesses, Threads.pptx
Processes, Threads.pptxSKUP1
 
C-Programming Control statements.pptx
C-Programming Control statements.pptxC-Programming Control statements.pptx
C-Programming Control statements.pptxSKUP1
 
Finite State Machine.ppt.pptx
Finite State Machine.ppt.pptxFinite State Machine.ppt.pptx
Finite State Machine.ppt.pptxSKUP1
 
FUNCTIONS IN C.pptx
FUNCTIONS IN C.pptxFUNCTIONS IN C.pptx
FUNCTIONS IN C.pptxSKUP1
 
cprogramming strings.pptx
cprogramming strings.pptxcprogramming strings.pptx
cprogramming strings.pptxSKUP1
 
UNIONS IN C.pptx
UNIONS IN C.pptxUNIONS IN C.pptx
UNIONS IN C.pptxSKUP1
 
OPERATORS IN C.pptx
OPERATORS IN C.pptxOPERATORS IN C.pptx
OPERATORS IN C.pptxSKUP1
 
cprogramming Structures.pptx
cprogramming Structures.pptxcprogramming Structures.pptx
cprogramming Structures.pptxSKUP1
 
C-Programming Function pointers.pptx
C-Programming  Function pointers.pptxC-Programming  Function pointers.pptx
C-Programming Function pointers.pptxSKUP1
 
POINTERS.pptx
POINTERS.pptxPOINTERS.pptx
POINTERS.pptxSKUP1
 
STACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSTACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSKUP1
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptxSKUP1
 
C MEMORY MODEL​.pptx
C MEMORY MODEL​.pptxC MEMORY MODEL​.pptx
C MEMORY MODEL​.pptxSKUP1
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxSKUP1
 
DYNAMIC MEMORY ALLOCATION.pptx
DYNAMIC MEMORY ALLOCATION.pptxDYNAMIC MEMORY ALLOCATION.pptx
DYNAMIC MEMORY ALLOCATION.pptxSKUP1
 
COMPILATION PROCESS IN C.pptx
COMPILATION PROCESS IN C.pptxCOMPILATION PROCESS IN C.pptx
COMPILATION PROCESS IN C.pptxSKUP1
 

More from SKUP1 (20)

serial_busses_i2c.pptx
serial_busses_i2c.pptxserial_busses_i2c.pptx
serial_busses_i2c.pptx
 
DESIGN PATTERN.pptx
DESIGN PATTERN.pptxDESIGN PATTERN.pptx
DESIGN PATTERN.pptx
 
INTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptxINTER PROCESS COMMUNICATION (IPC).pptx
INTER PROCESS COMMUNICATION (IPC).pptx
 
C-Programming File-handling-C.pptx
C-Programming  File-handling-C.pptxC-Programming  File-handling-C.pptx
C-Programming File-handling-C.pptx
 
Processes, Threads.pptx
Processes, Threads.pptxProcesses, Threads.pptx
Processes, Threads.pptx
 
C-Programming Control statements.pptx
C-Programming Control statements.pptxC-Programming Control statements.pptx
C-Programming Control statements.pptx
 
Finite State Machine.ppt.pptx
Finite State Machine.ppt.pptxFinite State Machine.ppt.pptx
Finite State Machine.ppt.pptx
 
FUNCTIONS IN C.pptx
FUNCTIONS IN C.pptxFUNCTIONS IN C.pptx
FUNCTIONS IN C.pptx
 
cprogramming strings.pptx
cprogramming strings.pptxcprogramming strings.pptx
cprogramming strings.pptx
 
UNIONS IN C.pptx
UNIONS IN C.pptxUNIONS IN C.pptx
UNIONS IN C.pptx
 
OPERATORS IN C.pptx
OPERATORS IN C.pptxOPERATORS IN C.pptx
OPERATORS IN C.pptx
 
cprogramming Structures.pptx
cprogramming Structures.pptxcprogramming Structures.pptx
cprogramming Structures.pptx
 
C-Programming Function pointers.pptx
C-Programming  Function pointers.pptxC-Programming  Function pointers.pptx
C-Programming Function pointers.pptx
 
POINTERS.pptx
POINTERS.pptxPOINTERS.pptx
POINTERS.pptx
 
STACKS AND QUEUES.pptx
STACKS AND QUEUES.pptxSTACKS AND QUEUES.pptx
STACKS AND QUEUES.pptx
 
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptxC-Programming  C LIBRARIES AND USER DEFINED LIBRARIES.pptx
C-Programming C LIBRARIES AND USER DEFINED LIBRARIES.pptx
 
C MEMORY MODEL​.pptx
C MEMORY MODEL​.pptxC MEMORY MODEL​.pptx
C MEMORY MODEL​.pptx
 
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptxDATATYPES,KEYWORDS,FORMATSPECS[1].pptx
DATATYPES,KEYWORDS,FORMATSPECS[1].pptx
 
DYNAMIC MEMORY ALLOCATION.pptx
DYNAMIC MEMORY ALLOCATION.pptxDYNAMIC MEMORY ALLOCATION.pptx
DYNAMIC MEMORY ALLOCATION.pptx
 
COMPILATION PROCESS IN C.pptx
COMPILATION PROCESS IN C.pptxCOMPILATION PROCESS IN C.pptx
COMPILATION PROCESS IN C.pptx
 

Recently uploaded

Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...Call Girls in Nagpur High Profile
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 

Recently uploaded (20)

Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 

DATA STRUCTURES AND LINKED LISTS IN C.pptx

  • 1. DATA STRUCTURES AND LINKED LISTS IN C
  • 2. DATA STRUCTURES IN C • The data structure name indicates itself that organizing the data in memory. • There are many ways of organizing the data in the memory as we have already seen one of the data structures, i.e., array in C language. • It is a set of algorithms that we can use in any programming language to structure the data in the memory.
  • 4. TYPES • Primitive Data structure The primitive data structures are primitive data types. The int, char, float, double, and pointer are the primitive data structures that can hold a single value. • Non-Primitive Data structure The non-primitive data structure is divided into two types: 1. Linear data structure 2. Non-linear data structure
  • 5. TYPES • Linear data structure 1. The arrangement of data in a sequential manner is known as a linear data structure. 2. The data structures used for this purpose are Arrays, Linked list, Stacks, and Queues. 3. In these data structures, one element is connected to only one another element in a linear form. • Non-linear data structure 1. When one element is connected to the 'n' number of elements known as a non-linear data structure. 2. The best example is trees and graphs. 3. In this case, the elements are arranged in a random manner.
  • 6. TYPES • Data structures can also be classified as: 1. Static data structure: It is a type of data structure where the size is allocated at the compile time. Therefore, the maximum size is fixed. However, the values of the elements stored are not static and can be modified at any time. Example - Array. 2. Dynamic data structure: It is a type of data structure where the size is allocated at the run time. Therefore, the maximum size is flexible. Example - Linked List.
  • 7. OPERATIONS ON DATA STRUCTURES • Searching: We can search for any element in a data structure. • Sorting: We can sort the elements of a data structure either in an ascending or descending order. • Insertion: We can also insert the new element in a data structure. • Update: We can also update the element, i.e., we can replace the element with another element. • Deletion: We can also perform the delete operation to remove the element from the data structure.
  • 8. LINKED LISTS • Like arrays, Linked List is a linear data structure. • Unlike arrays, linked list elements are not stored at a contiguous location; the elements are linked using pointers. • They includes a series of connected nodes. • Here, each node stores the data and the address of the next node.
  • 9. USES • The list is not required to be contiguously present in the memory. The node can reside any where in the memory and linked together to make a list. This achieves optimized utilization of space. • list size is limited to the memory size and doesn't need to be declared in advance. • Empty node can not be present in the linked list. • We can store values of primitive types or objects in the singly linked list.
  • 10. SINGLY LINKED LIST • Singly linked list can be defined as the collection of ordered set of elements. • The number of elements may vary according to need of the program. • A node in the singly linked list consist of two parts: data part and link part. • Data part of the node stores actual information that is to be represented by the node while the link part of the node stores the address of its immediate successor. • One way chain or singly linked list can be traversed only in one direction.
  • 11. DOUBLY LINKED LIST • Doubly linked list is a complex type of linked list in which a node contains a pointer to the previous as well as the next node in the sequence. • Therefore, in a doubly linked list, a node consists of three parts: node data, pointer to the next node in sequence (next pointer) , pointer to the previous node (previous pointer). • The prev part of the first node and the next part of the last node will always contain null indicating end in each direction. • Due to the fact that, each node of the list contains the address of its previous node
  • 12. CIRCULAR LINKED LIST • In a circular Singly linked list, the last node of the list contains a pointer to the first node of the list. • We can have circular singly linked list as well as circular doubly linked list. • We traverse a circular singly linked list until we reach the same node where we started. • The circular singly liked list has no beginning and no ending. There is no null value present in the next part of any of the nodes.
  • 13. CIRCULAR DOUBLY LINKED LIST • Circular doubly linked list is a more complexed type of data structure in which a node contain pointers to its previous node as well as the next node. • Circular doubly linked list doesn't contain NULL in any of the node. • The last node of the list contains the address of the first node of the list. • The first node of the list also contain address of the last node in its previous pointer
  • 14. INSERTING A NODE • A node can be added in three ways 1. At the front of the linked list 2. After a given node. 3. At the end of the linked list.
  • 15. DELETING A NODE • Delete from Beginning: Point head to the next node i.e. second node head = head->next • Delete from end: Point head to the previous element i.e. last second element. Change next pointer to null struct node*temp = head; while(temp->next->next!=NULL) { temp = temp->next } temp->next = NULL
  • 16. DELETING A NODE • Delete from Middle: Traverse to element before the element to be deleted Change next pointer to exclude the node from the chain for(int i=2; i< position; i++) { if(temp->next!=NULL) { temp = temp->next; } } temp->next = temp->next->next;