SlideShare a Scribd company logo
1 of 33
CPEN 204
Data Structures
Lecture 02
ARRAYS AND LINKED LIST
AS ADT
Outline
• What are Data Types ?
• What is Abstact Data Types (ADTs)?
• Why ADT?
• Arrays as an ADT
• Link List as an ADT
• Assignment #2
What are Data Types ?
• Defines a certain domain of values
• Defines operations allowed on those values.
• Eg.
• Int ype
• - takes only integer values
• Operations: addition, subtraction,
multiplication, bitwise operations etc.
What is ADT?
• ADTs are like user defined data types which
defines operations on values using
functions without specifying what is there
inside the function and how the operations are
performed.
What is ADT?
• Eg. Stack ADT
• A stack consists of elements of the same type
arranged in a sequential order.
• Operations: initialize(), push(), pop(),
isEmpty(), isFull()
Why ADTs
• A program which uses data structure is
called a client program.
• It has access to the ADTs ie. Interface
• The program which implements the data
structure is called implementation
Advantages of DTs
• It can be used without knowing the
implementation.
• Implementation can be changed from
one type to the other without affecting
the client program.
Arrays
• The simplest type of data structure is a linear (or
one dimensional) array. E.g.
– A 1, A 2, A 3 . . . . A n
– or by the parenthesis notation
• A (1), A (2), A (3) . . . . . . A (n)
– or by the bracket notation
• A [1], A [2], A [3] . . . . . . A [n]
• A[8] =
Arrays as an ADT
• Arrays are used for implementing a variety of other
data structures.
• string,
• Strings composed of zeros and ones are called
binary strings or bit strings.
• Strings are indispensable for processing textual data,
defining computer languages and compiling programs
written in them, and studying abstract computational
models.
Operations on array
• Traversing: it means processing or visiting each
element in the array exactly once.
• Insertion: means to put values into an array
• Deletion / Remove: to delete a value from an
array.
Operations on array
• Sorting: Re-arrangement of values in an array in
a specific order
• (Ascending / Descending) is called sorting.
• Searching: The process of finding the location of
a particular element in an array is called
searching.
There are two popular searching techniques:
• Linear search and binary search and will be
Limitations of Arrays
• An array has a fixed size which means you
cannot add/delete elements after creation.
• You also cannot resize them dynamically.
• Unlike lists in Python, cannot store values of
different data types in a single array.
Linked List as an ADT
Objectives
–Learn about linked list
– Be aware of basic properties of linked list
– Explore the insertion and deletion operations on
linked list
– Discover how to build and manipulate a linked list
– Learn how to construct a doubly linked list
What is a List
• A list is a finite sequence of data items, i.e., a
collection of data items arranged in a certain linear
order.
Ways of storing list In memory:
• sequential memory locations i.e store the list in
arrays.
• using pointers or links to associate elements
sequentially i.e known as linked list.
Linked Lists
• A linked list is a sequence of zero or more elements
called nodes.
• Each item in the list is called a node.
• Each node contains two kinds of information:
o some data and
o one or more links called pointers to other nodes of the
linked list.
Linked Lists
• Information- contains the item being stored in the
list.
• Next address- contains the address of the next item
in the list.
• The last node in the list contains NULL pointer to
indicate that it is the end of the list.
Linked List
• Linked list is a very flexible dynamic data
structure :
• ie. items may be added to it or deleted from it
at will.
• program will have to accommodate in
advance.
• This allows robust programs which require
much less maintenance.
Types of Linked lists
• Singly Linked List : A singly linked list, or
simply a linked list, is a linear collection of data
items.
•
Singly Linked List
• A singly linked list has the disadvantage that we can
only traverse it in one direction.
• Many applications require searching backwards
and forwards through sections of a list.
Doubly Linked List
•Doubly Linked List permit traversing or searching of
the list in both directions.
•In this linked list each node contains three fields.
– One to store data
– Remaining are self referential pointers which points
to previous and next nodes in the list
Implementation of node using structure
• Method -1:
struct node
{
int data;
struct node *prev; struct node * next;
};
Implementation of node using class
• Method -2:
class node
{
public:
int data; node *prev; node * next;
};
Insertions operation
• To place an elements in the list there are 3 cases
 At the beginning
 End of the list
 At a given position
Deletions operation
Removing an element from the list, without destroying
the integrity of the list itself.
To place an element from the list there are 3 cases :
Delete a node at beginning of the list
Delete a node at end of the list
Delete a node at a given position
Circularly Linked List
• Simply circular list, is a linked list in which the last
node always points to the first node.
• It can be built by replacing the NULL pointer at the
end of the list with a pointer which points to the first
node.
• There is no first or last node in the circular list.
Advantages
Any node can be traversed starting from any other
node in the list.
There is no need of NULL pointer to signal the end
of the list and hence, all pointers contain valid
addresses.
In contrast to singly linked list, deletion operation
in circular list is simplified as the search for the
previous node of an element to be deleted can be
started from that item itself.
Applications of the Linked List
• It can be used to represent polynomials.
• Using a linked list, we can perform the
polynomial manipulation.
• performed addition or subtraction of long
integers arithmetic operations.
• To implement stacks and queues.
Limitations of Linked List
The linked allocation has the following draw backs:
• No direct access to a particular element.
• Additional memory required for pointers.
• Searching must be done sequentially, however,
when the list is large, it becomes time consuming.
Basic Operations
• 1. Initialize the list.
• 2. Determine whether the list is empty.
• 3. Print the list.
• 4. Find the length of the list.
• 5. Destroy the list
Basic Operations
• 16. Retrieve the info contained in the first node.
• 7. Retrieve the info contained in the last node.
• 8. Search the list for a given item.
• 9. Insert an item in the list.
• 10. Delete an item from the list.
• 11. Make a copy of the linked list
Operations of Linked List
• Operations on Doubly linked list:
 Insertion of a node
 Deletions of a node
 Traversing the list
Assignment 02
1. Write the algorithm and a program to determine the
median of the array given below: (9, 4, 5, 1, 7, 78,
22, 15, 96, 45,25)
Note that the median of an array is the middle element
of a sorted array.
2. Discuss 4 differences between Circular Array and
Linked List

More Related Content

Similar to lecture 02.2.ppt

linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
Data structures - unit 1
Data structures - unit 1Data structures - unit 1
Data structures - unit 1SaranyaP45
 
Data structures and Algorithm analysis_Lecture 2.pptx
Data structures and Algorithm analysis_Lecture 2.pptxData structures and Algorithm analysis_Lecture 2.pptx
Data structures and Algorithm analysis_Lecture 2.pptxAhmedEldesoky24
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptxsarala9
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptxSaralaT3
 
Data Structure & Algorithm.pptx
Data Structure & Algorithm.pptxData Structure & Algorithm.pptx
Data Structure & Algorithm.pptxMumtaz
 
Data Structure & Algorithms - Operations
Data Structure & Algorithms - OperationsData Structure & Algorithms - Operations
Data Structure & Algorithms - Operationsbabuk110
 
Lists, Stacks, and Queues: Abstract Data Types
Lists, Stacks, and Queues: Abstract Data TypesLists, Stacks, and Queues: Abstract Data Types
Lists, Stacks, and Queues: Abstract Data TypesHasan Dwi Cahyono
 
Unit 2 linear data structures
Unit 2   linear data structuresUnit 2   linear data structures
Unit 2 linear data structuresSenthil Murugan
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power pMeghaKulkarni27
 
Python Data Structures and Algorithms.pptx
Python Data Structures and Algorithms.pptxPython Data Structures and Algorithms.pptx
Python Data Structures and Algorithms.pptxShreyasLawand
 
Unit 1 Basic concepts to DS
Unit 1 Basic concepts to DSUnit 1 Basic concepts to DS
Unit 1 Basic concepts to DSLavanyaJ28
 

Similar to lecture 02.2.ppt (20)

Data Structures 3
Data Structures 3Data Structures 3
Data Structures 3
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Data structures - unit 1
Data structures - unit 1Data structures - unit 1
Data structures - unit 1
 
unit 1.pptx
unit 1.pptxunit 1.pptx
unit 1.pptx
 
Unit 1.ppt
Unit 1.pptUnit 1.ppt
Unit 1.ppt
 
Linked List
Linked ListLinked List
Linked List
 
Data structures and Algorithm analysis_Lecture 2.pptx
Data structures and Algorithm analysis_Lecture 2.pptxData structures and Algorithm analysis_Lecture 2.pptx
Data structures and Algorithm analysis_Lecture 2.pptx
 
Linked list
Linked listLinked list
Linked list
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
Data Structure & Algorithm.pptx
Data Structure & Algorithm.pptxData Structure & Algorithm.pptx
Data Structure & Algorithm.pptx
 
Data Structure & Algorithms - Operations
Data Structure & Algorithms - OperationsData Structure & Algorithms - Operations
Data Structure & Algorithms - Operations
 
Linked list
Linked listLinked list
Linked list
 
Lists, Stacks, and Queues: Abstract Data Types
Lists, Stacks, and Queues: Abstract Data TypesLists, Stacks, and Queues: Abstract Data Types
Lists, Stacks, and Queues: Abstract Data Types
 
Unit 2 linear data structures
Unit 2   linear data structuresUnit 2   linear data structures
Unit 2 linear data structures
 
stack.pptx
stack.pptxstack.pptx
stack.pptx
 
Linked list
Linked listLinked list
Linked list
 
data structures and applications power p
data structures and applications power pdata structures and applications power p
data structures and applications power p
 
Python Data Structures and Algorithms.pptx
Python Data Structures and Algorithms.pptxPython Data Structures and Algorithms.pptx
Python Data Structures and Algorithms.pptx
 
Unit 1 Basic concepts to DS
Unit 1 Basic concepts to DSUnit 1 Basic concepts to DS
Unit 1 Basic concepts to DS
 

Recently uploaded

Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 

Recently uploaded (20)

Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 

lecture 02.2.ppt

  • 1. CPEN 204 Data Structures Lecture 02 ARRAYS AND LINKED LIST AS ADT
  • 2. Outline • What are Data Types ? • What is Abstact Data Types (ADTs)? • Why ADT? • Arrays as an ADT • Link List as an ADT • Assignment #2
  • 3. What are Data Types ? • Defines a certain domain of values • Defines operations allowed on those values. • Eg. • Int ype • - takes only integer values • Operations: addition, subtraction, multiplication, bitwise operations etc.
  • 4. What is ADT? • ADTs are like user defined data types which defines operations on values using functions without specifying what is there inside the function and how the operations are performed.
  • 5. What is ADT? • Eg. Stack ADT • A stack consists of elements of the same type arranged in a sequential order. • Operations: initialize(), push(), pop(), isEmpty(), isFull()
  • 6. Why ADTs • A program which uses data structure is called a client program. • It has access to the ADTs ie. Interface • The program which implements the data structure is called implementation
  • 7. Advantages of DTs • It can be used without knowing the implementation. • Implementation can be changed from one type to the other without affecting the client program.
  • 8. Arrays • The simplest type of data structure is a linear (or one dimensional) array. E.g. – A 1, A 2, A 3 . . . . A n – or by the parenthesis notation • A (1), A (2), A (3) . . . . . . A (n) – or by the bracket notation • A [1], A [2], A [3] . . . . . . A [n] • A[8] =
  • 9. Arrays as an ADT • Arrays are used for implementing a variety of other data structures. • string, • Strings composed of zeros and ones are called binary strings or bit strings. • Strings are indispensable for processing textual data, defining computer languages and compiling programs written in them, and studying abstract computational models.
  • 10. Operations on array • Traversing: it means processing or visiting each element in the array exactly once. • Insertion: means to put values into an array • Deletion / Remove: to delete a value from an array.
  • 11. Operations on array • Sorting: Re-arrangement of values in an array in a specific order • (Ascending / Descending) is called sorting. • Searching: The process of finding the location of a particular element in an array is called searching. There are two popular searching techniques: • Linear search and binary search and will be
  • 12. Limitations of Arrays • An array has a fixed size which means you cannot add/delete elements after creation. • You also cannot resize them dynamically. • Unlike lists in Python, cannot store values of different data types in a single array.
  • 13. Linked List as an ADT Objectives –Learn about linked list – Be aware of basic properties of linked list – Explore the insertion and deletion operations on linked list – Discover how to build and manipulate a linked list – Learn how to construct a doubly linked list
  • 14. What is a List • A list is a finite sequence of data items, i.e., a collection of data items arranged in a certain linear order. Ways of storing list In memory: • sequential memory locations i.e store the list in arrays. • using pointers or links to associate elements sequentially i.e known as linked list.
  • 15. Linked Lists • A linked list is a sequence of zero or more elements called nodes. • Each item in the list is called a node. • Each node contains two kinds of information: o some data and o one or more links called pointers to other nodes of the linked list.
  • 16. Linked Lists • Information- contains the item being stored in the list. • Next address- contains the address of the next item in the list. • The last node in the list contains NULL pointer to indicate that it is the end of the list.
  • 17. Linked List • Linked list is a very flexible dynamic data structure : • ie. items may be added to it or deleted from it at will. • program will have to accommodate in advance. • This allows robust programs which require much less maintenance.
  • 18. Types of Linked lists • Singly Linked List : A singly linked list, or simply a linked list, is a linear collection of data items. •
  • 19. Singly Linked List • A singly linked list has the disadvantage that we can only traverse it in one direction. • Many applications require searching backwards and forwards through sections of a list.
  • 20. Doubly Linked List •Doubly Linked List permit traversing or searching of the list in both directions. •In this linked list each node contains three fields. – One to store data – Remaining are self referential pointers which points to previous and next nodes in the list
  • 21. Implementation of node using structure • Method -1: struct node { int data; struct node *prev; struct node * next; };
  • 22. Implementation of node using class • Method -2: class node { public: int data; node *prev; node * next; };
  • 23. Insertions operation • To place an elements in the list there are 3 cases  At the beginning  End of the list  At a given position
  • 24. Deletions operation Removing an element from the list, without destroying the integrity of the list itself. To place an element from the list there are 3 cases : Delete a node at beginning of the list Delete a node at end of the list Delete a node at a given position
  • 25.
  • 26. Circularly Linked List • Simply circular list, is a linked list in which the last node always points to the first node. • It can be built by replacing the NULL pointer at the end of the list with a pointer which points to the first node. • There is no first or last node in the circular list.
  • 27. Advantages Any node can be traversed starting from any other node in the list. There is no need of NULL pointer to signal the end of the list and hence, all pointers contain valid addresses. In contrast to singly linked list, deletion operation in circular list is simplified as the search for the previous node of an element to be deleted can be started from that item itself.
  • 28. Applications of the Linked List • It can be used to represent polynomials. • Using a linked list, we can perform the polynomial manipulation. • performed addition or subtraction of long integers arithmetic operations. • To implement stacks and queues.
  • 29. Limitations of Linked List The linked allocation has the following draw backs: • No direct access to a particular element. • Additional memory required for pointers. • Searching must be done sequentially, however, when the list is large, it becomes time consuming.
  • 30. Basic Operations • 1. Initialize the list. • 2. Determine whether the list is empty. • 3. Print the list. • 4. Find the length of the list. • 5. Destroy the list
  • 31. Basic Operations • 16. Retrieve the info contained in the first node. • 7. Retrieve the info contained in the last node. • 8. Search the list for a given item. • 9. Insert an item in the list. • 10. Delete an item from the list. • 11. Make a copy of the linked list
  • 32. Operations of Linked List • Operations on Doubly linked list:  Insertion of a node  Deletions of a node  Traversing the list
  • 33. Assignment 02 1. Write the algorithm and a program to determine the median of the array given below: (9, 4, 5, 1, 7, 78, 22, 15, 96, 45,25) Note that the median of an array is the middle element of a sorted array. 2. Discuss 4 differences between Circular Array and Linked List