SlideShare a Scribd company logo
UNIT 1
 Array is a container which can hold a fix
number of items and these items should be of the
same type. Most of the data structures make use of
arrays to implement their algorithms. Following are
the important terms to understand the concept of
array.
 Element – Each item stored in an array is
 called an element.
 Index – Each location of an element in
 an array has a numerical index, which is
used
 to identify the element.
 The sequential representation uses an array to store
information corresponding to each node of a tree. Consider
the binary tree shown in Figure 1.1 . Its depth is 5 and it has
fourteen nodes. The nodes are numbered in a special way.
This numbering may obtained by preorder traversing the
tree and as each node is accessed , assigning it a node
number. The root is assigned 1, each left successor of a node
is assigned twice the number of its predecessor, and each
right successor is assigned one more than twice the
number of its predecessor. With nodes numbered in this
way, the predecessor of node i is numbered i/2 (integer
divide), its left successor is numbered 2*i, and its right
successor 2*i+1.
data structures and algorithms Unit 1
 A type of list is known as an ordered list. The
structure of an ordered list is a collection of items
where each item holds a relative position that is based
upon some underlying characteristics of the item. The
ordering is typically either ascending or descending
and we assume that list items have a meaningful
comparison operation that is already defined . Many of
the list operations are the same as those of the
unordered list.
 Stack :
 A stack is a linear data structure in which
elements can be inserted and deleted only from
one side of the list, called the top. A stack follows
the LIFO (Last In First Out) principle, i.e., the
element inserted at the last is the first element to
come out. The insertion of an element into stack is
called push operation, and deletion of an element
from the stack is called pop operation. In stack we
always keep track of the last element present in the
list with a pointer called top.
 The diagrammatic representation of stack is given
below :
 Queue:
 A queue is linear data structure in which elements
can be inserted only from one side of the list called
rear, and the elements can be deleted only from the
other side called the front . The queue data structure
follows the FIFO (First In First Out) principle, i.e., the
element inserted at first in the list, is the first element
to be removed from the list. The insertion of an
element in a queue is called an enqueue operation
and deletion of an element is called a dequeue
operation.
 The diagrammatic representation of queue is given
below:
Evaluate an expression represented by a string .
Expression can contain parentheses, you can assume only
binary operations allowed are +, -, *, and /. Arithmetic
expressions can be written in one of three forms :
Infix Notation: Operators are written between the
operands they operate on, e.g. 3+4 .
Prefix Notation: Operators are written before the
operands, e.g. +3 4
Postfix Notation: Operators are written after operands.
 Up to now we have been concerned only with the
representation of a single stack or a single queue in the
memory of a computer. For these two cases we have
seen efficient sequential data representations.
B(i) = T(i) = [m/n] (i-1),1<i<n
 A Linked list is a way to store a collection of
elements. Like an array these can be character or
integers. Each element in a linked list is stored in the
form of node.
 A node is a collection of two sub-elements or parts.
A data part that stores the element and a next part
that stores the link to the node.
 To represent stacks and queues sequentially. Such a
representation proved efficient if we had only one
stack or one queue. However, When several stacks and
queues co-exist, there was no efficient way to represent
them sequentially. In this section we present a good
solution to this problem using linked list.
 T(i) = Top of ith stack 1<i<n
 F(i) = Front of ith queue 1<i<m
 R(i) = Rear of ith queue 1<i<m
 Initial conditions:
 T(i) = 0 1<i<n
 F(i) = 0 1<i<m
 Boundary conditions:
 T(i) = 0 iff stack i empty
 F(i) = 0 iff queue i empty
 The manipulation of symbolic polynomials, has
become a classical example of the use of list
processing. To represent any number of different
polynomials as long as their combined size does not
exceed our block of memory. In general , we want
represent the polynomial.
 A(x) = amxem+……+a1xe1
data structures and algorithms Unit 1
Ad

More Related Content

What's hot (20)

Ds mcq
Ds mcqDs mcq
Ds mcq
Prakash Arumugam
 
Data Structure
Data Structure Data Structure
Data Structure
Ibrahim MH
 
DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGE
shubhamrohiwal6
 
Data structure
Data structureData structure
Data structure
Nihal Singh
 
Unit 4
Unit 4Unit 4
Unit 4
SHIKHA GAUTAM
 
Presentation on python data type
Presentation on python data typePresentation on python data type
Presentation on python data type
swati kushwaha
 
Computer Science-Data Structures :Abstract DataType (ADT)
Computer Science-Data Structures :Abstract DataType (ADT)Computer Science-Data Structures :Abstract DataType (ADT)
Computer Science-Data Structures :Abstract DataType (ADT)
St Mary's College,Thrissur,Kerala
 
Data structure day1
Data structure day1Data structure day1
Data structure day1
Mohammed Elsdody
 
Presentation on Data Structure
Presentation on Data StructurePresentation on Data Structure
Presentation on Data Structure
A. N. M. Jubaer
 
2 marks- DS using python
2 marks- DS using python2 marks- DS using python
2 marks- DS using python
LavanyaJ28
 
Unit 1 linked list
Unit 1 linked listUnit 1 linked list
Unit 1 linked list
LavanyaJ28
 
Ds important questions
Ds important questionsDs important questions
Ds important questions
LavanyaJ28
 
Data Structure Question Bank(2 marks)
Data Structure Question Bank(2 marks)Data Structure Question Bank(2 marks)
Data Structure Question Bank(2 marks)
pushpalathakrishnan
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, Queue
Ghaffar Khan
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer Science
Transweb Global Inc
 
02 Stack
02 Stack02 Stack
02 Stack
Budditha Hettige
 
Introduction To Data Structures
Introduction To Data StructuresIntroduction To Data Structures
Introduction To Data Structures
Spotle.ai
 
Data Structures
Data StructuresData Structures
Data Structures
Nitesh Bichwani
 
L 15 ct1120
L 15 ct1120L 15 ct1120
L 15 ct1120
Zia Ush Shamszaman
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
Fahd Allebdi
 
Data Structure
Data Structure Data Structure
Data Structure
Ibrahim MH
 
DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGE
shubhamrohiwal6
 
Presentation on python data type
Presentation on python data typePresentation on python data type
Presentation on python data type
swati kushwaha
 
Presentation on Data Structure
Presentation on Data StructurePresentation on Data Structure
Presentation on Data Structure
A. N. M. Jubaer
 
2 marks- DS using python
2 marks- DS using python2 marks- DS using python
2 marks- DS using python
LavanyaJ28
 
Unit 1 linked list
Unit 1 linked listUnit 1 linked list
Unit 1 linked list
LavanyaJ28
 
Ds important questions
Ds important questionsDs important questions
Ds important questions
LavanyaJ28
 
Data Structure Question Bank(2 marks)
Data Structure Question Bank(2 marks)Data Structure Question Bank(2 marks)
Data Structure Question Bank(2 marks)
pushpalathakrishnan
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, Queue
Ghaffar Khan
 
Data Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer ScienceData Structure & Algorithms | Computer Science
Data Structure & Algorithms | Computer Science
Transweb Global Inc
 
Introduction To Data Structures
Introduction To Data StructuresIntroduction To Data Structures
Introduction To Data Structures
Spotle.ai
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
Fahd Allebdi
 

Similar to data structures and algorithms Unit 1 (20)

data structure and algorithm note for IT students
data structure and algorithm note for IT studentsdata structure and algorithm note for IT students
data structure and algorithm note for IT students
RameshTharu5
 
unit 5 stack & queue.ppt
unit 5 stack & queue.pptunit 5 stack & queue.ppt
unit 5 stack & queue.ppt
SeethaDinesh
 
CDS artificial intelligence and Machine.docx
CDS artificial intelligence and Machine.docxCDS artificial intelligence and Machine.docx
CDS artificial intelligence and Machine.docx
msurfudeen6681
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductions
irshad17
 
LINKEDb2bb22bb3b3b3b3n3_LIST_UKL_1-2.ppt
LINKEDb2bb22bb3b3b3b3n3_LIST_UKL_1-2.pptLINKEDb2bb22bb3b3b3b3n3_LIST_UKL_1-2.ppt
LINKEDb2bb22bb3b3b3b3n3_LIST_UKL_1-2.ppt
Farhana859326
 
Data Structures Algorithms and Applications
Data Structures Algorithms and ApplicationsData Structures Algorithms and Applications
Data Structures Algorithms and Applications
harshavardhan543715
 
UNITIII LDS.pdf
UNITIII LDS.pdfUNITIII LDS.pdf
UNITIII LDS.pdf
meenamadhuvandhi2
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data Structure
Jazz Jinia Bhowmik
 
Data Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxData Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptx
UsriDevi1
 
Introduction in Data Structure - stack, Queue
Introduction in Data Structure - stack, QueueIntroduction in Data Structure - stack, Queue
Introduction in Data Structure - stack, Queue
BharathiKrishna6
 
Linked List Representation of a Linked List.pptx
Linked List Representation of a Linked List.pptxLinked List Representation of a Linked List.pptx
Linked List Representation of a Linked List.pptx
AAUsH2
 
9f556226-babd-4276-b964-371c6a5a77b9.pdf
9f556226-babd-4276-b964-371c6a5a77b9.pdf9f556226-babd-4276-b964-371c6a5a77b9.pdf
9f556226-babd-4276-b964-371c6a5a77b9.pdf
kumarharsh2119hk
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
ssuserd2f031
 
Data structures notes
Data structures notesData structures notes
Data structures notes
Upasana Talukdar
 
linked list in dsa python (presentation)
linked list in dsa python (presentation)linked list in dsa python (presentation)
linked list in dsa python (presentation)
MirzaAbdullahTariq
 
Review of basic data structures
Review of basic data structuresReview of basic data structures
Review of basic data structures
Deepa Rani
 
linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)
swajahatr
 
Introduction to linked list in data structure.pptx
Introduction to linked list in data structure.pptxIntroduction to linked list in data structure.pptx
Introduction to linked list in data structure.pptx
princydwn
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Malikireddy Bramhananda Reddy
 
1.1 ADS data-structure.pdf
1.1 ADS data-structure.pdf1.1 ADS data-structure.pdf
1.1 ADS data-structure.pdf
RameshBabuKellamapal
 
data structure and algorithm note for IT students
data structure and algorithm note for IT studentsdata structure and algorithm note for IT students
data structure and algorithm note for IT students
RameshTharu5
 
unit 5 stack & queue.ppt
unit 5 stack & queue.pptunit 5 stack & queue.ppt
unit 5 stack & queue.ppt
SeethaDinesh
 
CDS artificial intelligence and Machine.docx
CDS artificial intelligence and Machine.docxCDS artificial intelligence and Machine.docx
CDS artificial intelligence and Machine.docx
msurfudeen6681
 
Ch 1 intriductions
Ch 1 intriductionsCh 1 intriductions
Ch 1 intriductions
irshad17
 
LINKEDb2bb22bb3b3b3b3n3_LIST_UKL_1-2.ppt
LINKEDb2bb22bb3b3b3b3n3_LIST_UKL_1-2.pptLINKEDb2bb22bb3b3b3b3n3_LIST_UKL_1-2.ppt
LINKEDb2bb22bb3b3b3b3n3_LIST_UKL_1-2.ppt
Farhana859326
 
Data Structures Algorithms and Applications
Data Structures Algorithms and ApplicationsData Structures Algorithms and Applications
Data Structures Algorithms and Applications
harshavardhan543715
 
Introduction to Data Structure
Introduction to Data StructureIntroduction to Data Structure
Introduction to Data Structure
Jazz Jinia Bhowmik
 
Data Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptxData Structures & Algorithms Unit 1.pptx
Data Structures & Algorithms Unit 1.pptx
UsriDevi1
 
Introduction in Data Structure - stack, Queue
Introduction in Data Structure - stack, QueueIntroduction in Data Structure - stack, Queue
Introduction in Data Structure - stack, Queue
BharathiKrishna6
 
Linked List Representation of a Linked List.pptx
Linked List Representation of a Linked List.pptxLinked List Representation of a Linked List.pptx
Linked List Representation of a Linked List.pptx
AAUsH2
 
9f556226-babd-4276-b964-371c6a5a77b9.pdf
9f556226-babd-4276-b964-371c6a5a77b9.pdf9f556226-babd-4276-b964-371c6a5a77b9.pdf
9f556226-babd-4276-b964-371c6a5a77b9.pdf
kumarharsh2119hk
 
1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
ssuserd2f031
 
linked list in dsa python (presentation)
linked list in dsa python (presentation)linked list in dsa python (presentation)
linked list in dsa python (presentation)
MirzaAbdullahTariq
 
Review of basic data structures
Review of basic data structuresReview of basic data structures
Review of basic data structures
Deepa Rani
 
linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)
swajahatr
 
Introduction to linked list in data structure.pptx
Introduction to linked list in data structure.pptxIntroduction to linked list in data structure.pptx
Introduction to linked list in data structure.pptx
princydwn
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Malikireddy Bramhananda Reddy
 
Ad

Recently uploaded (20)

The History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptxThe History of Kashmir Karkota Dynasty NEP.pptx
The History of Kashmir Karkota Dynasty NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM & Mia eStudios
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
Myopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduateMyopathies (muscle disorders) for undergraduate
Myopathies (muscle disorders) for undergraduate
Mohamed Rizk Khodair
 
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...Transform tomorrow: Master benefits analysis with Gen AI today webinar,  30 A...
Transform tomorrow: Master benefits analysis with Gen AI today webinar, 30 A...
Association for Project Management
 
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living WorkshopLDMMIA Reiki Yoga S5 Daily Living Workshop
LDMMIA Reiki Yoga S5 Daily Living Workshop
LDM & Mia eStudios
 
Overview Well-Being and Creative Careers
Overview Well-Being and Creative CareersOverview Well-Being and Creative Careers
Overview Well-Being and Creative Careers
University of Amsterdam
 
Drugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdfDrugs in Anaesthesia and Intensive Care,.pdf
Drugs in Anaesthesia and Intensive Care,.pdf
crewot855
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
Chemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptxChemotherapy of Malignancy -Anticancer.pptx
Chemotherapy of Malignancy -Anticancer.pptx
Mayuri Chavan
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
Cultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptxCultivation Practice of Onion in Nepal.pptx
Cultivation Practice of Onion in Nepal.pptx
UmeshTimilsina1
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
Ad

data structures and algorithms Unit 1

  • 2.  Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of array.  Element – Each item stored in an array is  called an element.  Index – Each location of an element in  an array has a numerical index, which is used  to identify the element.
  • 3.  The sequential representation uses an array to store information corresponding to each node of a tree. Consider the binary tree shown in Figure 1.1 . Its depth is 5 and it has fourteen nodes. The nodes are numbered in a special way. This numbering may obtained by preorder traversing the tree and as each node is accessed , assigning it a node number. The root is assigned 1, each left successor of a node is assigned twice the number of its predecessor, and each right successor is assigned one more than twice the number of its predecessor. With nodes numbered in this way, the predecessor of node i is numbered i/2 (integer divide), its left successor is numbered 2*i, and its right successor 2*i+1.
  • 5.  A type of list is known as an ordered list. The structure of an ordered list is a collection of items where each item holds a relative position that is based upon some underlying characteristics of the item. The ordering is typically either ascending or descending and we assume that list items have a meaningful comparison operation that is already defined . Many of the list operations are the same as those of the unordered list.
  • 6.  Stack :  A stack is a linear data structure in which elements can be inserted and deleted only from one side of the list, called the top. A stack follows the LIFO (Last In First Out) principle, i.e., the element inserted at the last is the first element to come out. The insertion of an element into stack is called push operation, and deletion of an element from the stack is called pop operation. In stack we always keep track of the last element present in the list with a pointer called top.
  • 7.  The diagrammatic representation of stack is given below :
  • 8.  Queue:  A queue is linear data structure in which elements can be inserted only from one side of the list called rear, and the elements can be deleted only from the other side called the front . The queue data structure follows the FIFO (First In First Out) principle, i.e., the element inserted at first in the list, is the first element to be removed from the list. The insertion of an element in a queue is called an enqueue operation and deletion of an element is called a dequeue operation.
  • 9.  The diagrammatic representation of queue is given below:
  • 10. Evaluate an expression represented by a string . Expression can contain parentheses, you can assume only binary operations allowed are +, -, *, and /. Arithmetic expressions can be written in one of three forms : Infix Notation: Operators are written between the operands they operate on, e.g. 3+4 . Prefix Notation: Operators are written before the operands, e.g. +3 4 Postfix Notation: Operators are written after operands.
  • 11.  Up to now we have been concerned only with the representation of a single stack or a single queue in the memory of a computer. For these two cases we have seen efficient sequential data representations. B(i) = T(i) = [m/n] (i-1),1<i<n
  • 12.  A Linked list is a way to store a collection of elements. Like an array these can be character or integers. Each element in a linked list is stored in the form of node.
  • 13.  A node is a collection of two sub-elements or parts. A data part that stores the element and a next part that stores the link to the node.
  • 14.  To represent stacks and queues sequentially. Such a representation proved efficient if we had only one stack or one queue. However, When several stacks and queues co-exist, there was no efficient way to represent them sequentially. In this section we present a good solution to this problem using linked list.
  • 15.  T(i) = Top of ith stack 1<i<n  F(i) = Front of ith queue 1<i<m  R(i) = Rear of ith queue 1<i<m  Initial conditions:  T(i) = 0 1<i<n  F(i) = 0 1<i<m  Boundary conditions:  T(i) = 0 iff stack i empty  F(i) = 0 iff queue i empty
  • 16.  The manipulation of symbolic polynomials, has become a classical example of the use of list processing. To represent any number of different polynomials as long as their combined size does not exceed our block of memory. In general , we want represent the polynomial.  A(x) = amxem+……+a1xe1
  翻译: