SlideShare a Scribd company logo
Department of Informatics & Software Engineering
Data Structures
Second Year- First Semester
Academic Year: 2022-2023
Lecturer: Mr. Yazen Saifuldeen
Introduction to Programming
• Programming requires different kinds of information to be stored
in the computer and the input data to be processed. The
information can be stored in a generalized format using variables.
In principle, one variable allows the storage of a single data entity.
• Computer is a programmable data processor that accepts input and
instructions to process the input (program) and generates the
required output.
• Computers are competent to perform complex and difficult
operations, they are inherently simple and passive machines. They
must be told precisely and explicitly in a language they can
understand, as to what is to be done.
• This sequence of instructions is known as a program. A program
that satisfies user needs as per his/her specifications is called
software.
• The success of a software project often depends upon the choices
made in the representation of the data (data structure).
Introduction to Algorithms
Algorithms : A programmer should first solve the problem in a step-by-step
manner and then try to find the appropriate instruction or series of instructions that solves
the problem.
This step-by-step solution is called an algorithm. An algorithm is independent of the
computer system and the programming language.
Each algorithm includes steps for
1. input.
2. processing, and
3. output.
The two popular tools used in the representation of
algorithms are the following:
1. Pseudo code: An algorithm can be written in any of the
natural languages such as English, German, French, etc.
2. Flowchart : A very effective tool to show the logic
flow of a program is the flowchart. A flowchart is a
pictorial representation of an algorithm. It hides all the
details of an algorithm by giving a picture;
Introduction to Data Structures
• The term data structure refers to the organization of data elements and the interrelationships among
them.
• In the most general sense, a data structure is any data representation and its associated operations.
The term “data structure” means an organization or structuring for a collection of data items. A sorted
list of integers stored in an array is an example of such a structuring.
• Structures is a set of rules that holds the data together. In other words, if we take a combination of
data types and fit them into a structure such that we can define the relating rules, we can have data
structures that consist of other data structures too.
• Data is nothing but a piece of information. Data input, data manipulation (or data
processing), and data output are the functions of computers.
• Data structure can be also defined as a particular way of organizing data in a computer so that it can
be retrieved and used efficiently.
The Need for Data Structures
“How many people in my company make over $100,000 per year? Can we connect all of our
telephone customers with less than 1,000 miles of cable? “
—To answer questions like these, it is not enough to have the necessary information. We must
organize that information in a way that allows us to find the answers in time to satisfy our needs.
Different types of data structures
Criteria to choose correct Data Structure:
1. The size of data will be used.
2. The way that data will be used.
3. How often the data will be changed.
4. The time required to access any information in the data structure.
5. Required capacity.
6. The programming language/ method will be used.
Costs and Benefits
• Each data structure has associated costs and benefits. In practice, it is hardly ever
true that one data structure is better than another for use in all situations.
• Data structure requires a certain amount of space for each data item it stores, a
certain amount of time to perform a single basic operation, and a certain mount of
programming effort.
Operations that can be performed on data structures:
1. Traversing: It is used to access each data item exactly once so that it can
be processed.
2. Searching: It is used to find out the location of the data item if it exists in
the given collection of data items.
3. Inserting: It is used to add a new data item in the given collection of data items.
4. Deleting: It is used to delete an existing data item from the given
collection of data items.
5. Sorting: It is used to arrange the data items in some order i.e. in
ascending or descending order in case of numerical data and in dictionary
order in case of alphanumeric data.
6. Merging: It is used to combine the data items of two sorted files into
single file in the sorted form.
Classification of data structure
Data structures are broadly divided into two :
1. Primitive Data types:
are the basic data types that are available in most of the programming languages. The
primitive data types are used to represent single values like:
• Integer: This is used to represent a number without decimal point.
Example: 12, 90
• Float and Double: This is used to represent a number with decimal point.
Example: 45.1, 67.3
• Character: This is used to represent single character
Example: ‘C’, ‘a’
• String: This is used to represent group of characters.
Example: "CIHAN University“
• Boolean: This is used represent logical values either true or false.
2. Non-Primitive Data types:
are derived from primary data types and used to
store group of values like:
• Arrays
• Tree
• linked list
• Stacks
• Queue
Linear and Nonlinear data structure
Data can be organized in a linear or non-linear form:
Linear Data Structure: Is the data structure that every element is linked with the
next one sequentially. Since the data items are arranged in sequence. Samples of a
linear data structure are the stack and the queue.
Nonlinear data structure: is the data structure where the element may attach to
more than one element and data items are not in sequence. A sample of nonlinear
data structure is a tree.
Storage Allocation
It’s the way in which the data items are physically stored in the memory, so there are
the following two types
1. Sequential allocation: it’s the simpler way in which the data items are stored in
continuous memory allocations one by one. Arrays are the data types that are used to
implement such types of storages.
Sequential Allocation Advantages:
• Easy to implement.
• Less storage space.
Sequential Allocation Disadvantages:
• It needs a sequential free space in memory.
• It required that we know previously the max number of items that will be used.
• Over flow problem is occasionally occurs.
2. Dynamic Allocation:
implementation of data structure is the dynamic linking; since there is no sequential
allocation but every data item has the address of the next one instead. Here each data
item will be called as “node”; this node will have two parts, one carried the required
information and the other is for the next item address.
Dynamic Allocation Advantages:
• Easy to add or remove.
• No over flow problem.
• We do not need to specify the number of nodes previously.
Dynamic Allocation Disadvantages:
• More storage space for each data item, since each one must has a value and the
information of the next address as well.
• Complicated and hard to achieve random access.
Ad

More Related Content

Similar to Data Structure Introduction.pdfssssssssssss (20)

Data structure
Data  structureData  structure
Data structure
priyanka belekar
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
sunilchute1
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
sunilchute1
 
Unit-I PPT hususi sisooshsgv. Eijeieieooekejj
Unit-I PPT hususi sisooshsgv.     EijeieieooekejjUnit-I PPT hususi sisooshsgv.     Eijeieieooekejj
Unit-I PPT hususi sisooshsgv. Eijeieieooekejj
sanketkurve7
 
Datastructures Notes
Datastructures NotesDatastructures Notes
Datastructures Notes
Ranjithkumar C
 
Unit 2 DATABASE ESSENTIALS.pptx
Unit 2 DATABASE ESSENTIALS.pptxUnit 2 DATABASE ESSENTIALS.pptx
Unit 2 DATABASE ESSENTIALS.pptx
Nirmalavenkatachalam
 
Fundamental data structure
Fundamental data structureFundamental data structure
Fundamental data structure
Vrushali Dhanokar
 
Iare ds lecture_notes_2
Iare ds lecture_notes_2Iare ds lecture_notes_2
Iare ds lecture_notes_2
RajSingh734307
 
DATA-STRUCTURES.pptx
DATA-STRUCTURES.pptxDATA-STRUCTURES.pptx
DATA-STRUCTURES.pptx
RuchiNagar3
 
Data Structure Ppt for our engineering college industrial training.
Data Structure Ppt  for our engineering college industrial training.Data Structure Ppt  for our engineering college industrial training.
Data Structure Ppt for our engineering college industrial training.
AnumaiAshish
 
Introduction to data structures (ss)
Introduction to data structures (ss)Introduction to data structures (ss)
Introduction to data structures (ss)
Madishetty Prathibha
 
Unit-1 DataStructure Intro.pptx
Unit-1 DataStructure Intro.pptxUnit-1 DataStructure Intro.pptx
Unit-1 DataStructure Intro.pptx
ajajkhan16
 
data structures and algorithm Cha 1and 2.doc
data structures and algorithm Cha 1and 2.docdata structures and algorithm Cha 1and 2.doc
data structures and algorithm Cha 1and 2.doc
ephremmulu486
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptx
ssuser031f35
 
The Stack in Data structure and algorithm
The Stack in Data structure and algorithmThe Stack in Data structure and algorithm
The Stack in Data structure and algorithm
SourajitMaity1
 
DatabaseManagementSystem.pptx
DatabaseManagementSystem.pptxDatabaseManagementSystem.pptx
DatabaseManagementSystem.pptx
uwmctesting
 
DataStructurePpt-01.pptxEngineering data structure notes
DataStructurePpt-01.pptxEngineering data structure notesDataStructurePpt-01.pptxEngineering data structure notes
DataStructurePpt-01.pptxEngineering data structure notes
limev72215
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptx
DCABCA
 
Lect 1-2 Zaheer Abbas
Lect 1-2 Zaheer AbbasLect 1-2 Zaheer Abbas
Lect 1-2 Zaheer Abbas
Information Technology Center
 
DataStructureccvdgddfffdesddsssdssPpt.pptx
DataStructureccvdgddfffdesddsssdssPpt.pptxDataStructureccvdgddfffdesddsssdssPpt.pptx
DataStructureccvdgddfffdesddsssdssPpt.pptx
bgmi52926
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
sunilchute1
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
sunilchute1
 
Unit-I PPT hususi sisooshsgv. Eijeieieooekejj
Unit-I PPT hususi sisooshsgv.     EijeieieooekejjUnit-I PPT hususi sisooshsgv.     Eijeieieooekejj
Unit-I PPT hususi sisooshsgv. Eijeieieooekejj
sanketkurve7
 
Iare ds lecture_notes_2
Iare ds lecture_notes_2Iare ds lecture_notes_2
Iare ds lecture_notes_2
RajSingh734307
 
DATA-STRUCTURES.pptx
DATA-STRUCTURES.pptxDATA-STRUCTURES.pptx
DATA-STRUCTURES.pptx
RuchiNagar3
 
Data Structure Ppt for our engineering college industrial training.
Data Structure Ppt  for our engineering college industrial training.Data Structure Ppt  for our engineering college industrial training.
Data Structure Ppt for our engineering college industrial training.
AnumaiAshish
 
Introduction to data structures (ss)
Introduction to data structures (ss)Introduction to data structures (ss)
Introduction to data structures (ss)
Madishetty Prathibha
 
Unit-1 DataStructure Intro.pptx
Unit-1 DataStructure Intro.pptxUnit-1 DataStructure Intro.pptx
Unit-1 DataStructure Intro.pptx
ajajkhan16
 
data structures and algorithm Cha 1and 2.doc
data structures and algorithm Cha 1and 2.docdata structures and algorithm Cha 1and 2.doc
data structures and algorithm Cha 1and 2.doc
ephremmulu486
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptx
ssuser031f35
 
The Stack in Data structure and algorithm
The Stack in Data structure and algorithmThe Stack in Data structure and algorithm
The Stack in Data structure and algorithm
SourajitMaity1
 
DatabaseManagementSystem.pptx
DatabaseManagementSystem.pptxDatabaseManagementSystem.pptx
DatabaseManagementSystem.pptx
uwmctesting
 
DataStructurePpt-01.pptxEngineering data structure notes
DataStructurePpt-01.pptxEngineering data structure notesDataStructurePpt-01.pptxEngineering data structure notes
DataStructurePpt-01.pptxEngineering data structure notes
limev72215
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptx
DCABCA
 
DataStructureccvdgddfffdesddsssdssPpt.pptx
DataStructureccvdgddfffdesddsssdssPpt.pptxDataStructureccvdgddfffdesddsssdssPpt.pptx
DataStructureccvdgddfffdesddsssdssPpt.pptx
bgmi52926
 

Recently uploaded (20)

Download Canva Pro 2025 PC Crack Latest Full Version
Download Canva Pro 2025 PC Crack Latest Full VersionDownload Canva Pro 2025 PC Crack Latest Full Version
Download Canva Pro 2025 PC Crack Latest Full Version
fk5571293
 
Catch a glimpse of Marcie Phalen's newest post!
Catch a glimpse of Marcie Phalen's newest post!Catch a glimpse of Marcie Phalen's newest post!
Catch a glimpse of Marcie Phalen's newest post!
Marcie Phalen
 
Nature Mountain Background Slides pack.pptx
Nature Mountain Background Slides pack.pptxNature Mountain Background Slides pack.pptx
Nature Mountain Background Slides pack.pptx
mvsagar1981
 
Artworks Exhibited At Africa Remix (Group 8 Seminar).pptx
Artworks Exhibited At Africa Remix (Group 8 Seminar).pptxArtworks Exhibited At Africa Remix (Group 8 Seminar).pptx
Artworks Exhibited At Africa Remix (Group 8 Seminar).pptx
AHArt16
 
160642-x-mas-template-1ddfsfsdgga6x9.pptx
160642-x-mas-template-1ddfsfsdgga6x9.pptx160642-x-mas-template-1ddfsfsdgga6x9.pptx
160642-x-mas-template-1ddfsfsdgga6x9.pptx
Harim Qudsi
 
MiniTool Partition Wizard Crack 12.8 + Serial Key
MiniTool Partition Wizard Crack 12.8 + Serial KeyMiniTool Partition Wizard Crack 12.8 + Serial Key
MiniTool Partition Wizard Crack 12.8 + Serial Key
minhaz1122g
 
Cosmic Cookbook: Food Fight! Storyboard Binder
Cosmic Cookbook: Food Fight! Storyboard BinderCosmic Cookbook: Food Fight! Storyboard Binder
Cosmic Cookbook: Food Fight! Storyboard Binder
cgschieb
 
SCROOGE: Toast Sequence - Rough boards by Randeep Katari
SCROOGE: Toast Sequence - Rough boards by Randeep KatariSCROOGE: Toast Sequence - Rough boards by Randeep Katari
SCROOGE: Toast Sequence - Rough boards by Randeep Katari
Randeep Katari
 
The Story Of A Bug And His Boy Illustration Draft
The Story Of A Bug And His Boy Illustration DraftThe Story Of A Bug And His Boy Illustration Draft
The Story Of A Bug And His Boy Illustration Draft
worldwidepublicists
 
Smedley Combined Architectural Setet.pdf
Smedley Combined Architectural Setet.pdfSmedley Combined Architectural Setet.pdf
Smedley Combined Architectural Setet.pdf
3rdstoryphilly
 
ripublic day presentation JEEVIKA YADAV.pptx
ripublic day presentation JEEVIKA YADAV.pptxripublic day presentation JEEVIKA YADAV.pptx
ripublic day presentation JEEVIKA YADAV.pptx
exemptionepfofaridab
 
export_52fcdeb2-a217-453c-9bec-218ee401147b.pptx
export_52fcdeb2-a217-453c-9bec-218ee401147b.pptxexport_52fcdeb2-a217-453c-9bec-218ee401147b.pptx
export_52fcdeb2-a217-453c-9bec-218ee401147b.pptx
prachisinghal928
 
Fairy tail castañosqwertyuiopasdfgh.pptx
Fairy tail castañosqwertyuiopasdfgh.pptxFairy tail castañosqwertyuiopasdfgh.pptx
Fairy tail castañosqwertyuiopasdfgh.pptx
OLMOSCRUZDANIELA
 
SCROOGE: Sequence Office // Story Artist: Kartika Mediani - Feedback: Randeep...
SCROOGE: Sequence Office // Story Artist: Kartika Mediani - Feedback: Randeep...SCROOGE: Sequence Office // Story Artist: Kartika Mediani - Feedback: Randeep...
SCROOGE: Sequence Office // Story Artist: Kartika Mediani - Feedback: Randeep...
Randeep Katari
 
ALIEN EXPLORER .
ALIEN EXPLORER                             .ALIEN EXPLORER                             .
ALIEN EXPLORER .
bucetked
 
Nike Defend The Arch Ad - Golden Wolf - Boards by Randeep Katari
Nike Defend The Arch Ad - Golden Wolf - Boards by Randeep KatariNike Defend The Arch Ad - Golden Wolf - Boards by Randeep Katari
Nike Defend The Arch Ad - Golden Wolf - Boards by Randeep Katari
Randeep Katari
 
470195995-Millennials-assssssssssssssnd-Filinnials-Ethical-Challenges-and-Res...
470195995-Millennials-assssssssssssssnd-Filinnials-Ethical-Challenges-and-Res...470195995-Millennials-assssssssssssssnd-Filinnials-Ethical-Challenges-and-Res...
470195995-Millennials-assssssssssssssnd-Filinnials-Ethical-Challenges-and-Res...
JackAaronZambrano
 
_04 Template PPT.pptxttttttttttttttttttttttttttttttttttttttttttt
_04 Template PPT.pptxttttttttttttttttttttttttttttttttttttttttttt_04 Template PPT.pptxttttttttttttttttttttttttttttttttttttttttttt
_04 Template PPT.pptxttttttttttttttttttttttttttttttttttttttttttt
Doni43566
 
traffic_signal.pptx.ppthhahajjajakaakakaka
traffic_signal.pptx.ppthhahajjajakaakakakatraffic_signal.pptx.ppthhahajjajakaakakaka
traffic_signal.pptx.ppthhahajjajakaakakaka
pradeepmogili648
 
IDM Crack 6.42 Build 35 Patch + Serial Key Download [Latest]
IDM Crack 6.42 Build 35 Patch + Serial Key Download [Latest]IDM Crack 6.42 Build 35 Patch + Serial Key Download [Latest]
IDM Crack 6.42 Build 35 Patch + Serial Key Download [Latest]
ajahsan727727
 
Download Canva Pro 2025 PC Crack Latest Full Version
Download Canva Pro 2025 PC Crack Latest Full VersionDownload Canva Pro 2025 PC Crack Latest Full Version
Download Canva Pro 2025 PC Crack Latest Full Version
fk5571293
 
Catch a glimpse of Marcie Phalen's newest post!
Catch a glimpse of Marcie Phalen's newest post!Catch a glimpse of Marcie Phalen's newest post!
Catch a glimpse of Marcie Phalen's newest post!
Marcie Phalen
 
Nature Mountain Background Slides pack.pptx
Nature Mountain Background Slides pack.pptxNature Mountain Background Slides pack.pptx
Nature Mountain Background Slides pack.pptx
mvsagar1981
 
Artworks Exhibited At Africa Remix (Group 8 Seminar).pptx
Artworks Exhibited At Africa Remix (Group 8 Seminar).pptxArtworks Exhibited At Africa Remix (Group 8 Seminar).pptx
Artworks Exhibited At Africa Remix (Group 8 Seminar).pptx
AHArt16
 
160642-x-mas-template-1ddfsfsdgga6x9.pptx
160642-x-mas-template-1ddfsfsdgga6x9.pptx160642-x-mas-template-1ddfsfsdgga6x9.pptx
160642-x-mas-template-1ddfsfsdgga6x9.pptx
Harim Qudsi
 
MiniTool Partition Wizard Crack 12.8 + Serial Key
MiniTool Partition Wizard Crack 12.8 + Serial KeyMiniTool Partition Wizard Crack 12.8 + Serial Key
MiniTool Partition Wizard Crack 12.8 + Serial Key
minhaz1122g
 
Cosmic Cookbook: Food Fight! Storyboard Binder
Cosmic Cookbook: Food Fight! Storyboard BinderCosmic Cookbook: Food Fight! Storyboard Binder
Cosmic Cookbook: Food Fight! Storyboard Binder
cgschieb
 
SCROOGE: Toast Sequence - Rough boards by Randeep Katari
SCROOGE: Toast Sequence - Rough boards by Randeep KatariSCROOGE: Toast Sequence - Rough boards by Randeep Katari
SCROOGE: Toast Sequence - Rough boards by Randeep Katari
Randeep Katari
 
The Story Of A Bug And His Boy Illustration Draft
The Story Of A Bug And His Boy Illustration DraftThe Story Of A Bug And His Boy Illustration Draft
The Story Of A Bug And His Boy Illustration Draft
worldwidepublicists
 
Smedley Combined Architectural Setet.pdf
Smedley Combined Architectural Setet.pdfSmedley Combined Architectural Setet.pdf
Smedley Combined Architectural Setet.pdf
3rdstoryphilly
 
ripublic day presentation JEEVIKA YADAV.pptx
ripublic day presentation JEEVIKA YADAV.pptxripublic day presentation JEEVIKA YADAV.pptx
ripublic day presentation JEEVIKA YADAV.pptx
exemptionepfofaridab
 
export_52fcdeb2-a217-453c-9bec-218ee401147b.pptx
export_52fcdeb2-a217-453c-9bec-218ee401147b.pptxexport_52fcdeb2-a217-453c-9bec-218ee401147b.pptx
export_52fcdeb2-a217-453c-9bec-218ee401147b.pptx
prachisinghal928
 
Fairy tail castañosqwertyuiopasdfgh.pptx
Fairy tail castañosqwertyuiopasdfgh.pptxFairy tail castañosqwertyuiopasdfgh.pptx
Fairy tail castañosqwertyuiopasdfgh.pptx
OLMOSCRUZDANIELA
 
SCROOGE: Sequence Office // Story Artist: Kartika Mediani - Feedback: Randeep...
SCROOGE: Sequence Office // Story Artist: Kartika Mediani - Feedback: Randeep...SCROOGE: Sequence Office // Story Artist: Kartika Mediani - Feedback: Randeep...
SCROOGE: Sequence Office // Story Artist: Kartika Mediani - Feedback: Randeep...
Randeep Katari
 
ALIEN EXPLORER .
ALIEN EXPLORER                             .ALIEN EXPLORER                             .
ALIEN EXPLORER .
bucetked
 
Nike Defend The Arch Ad - Golden Wolf - Boards by Randeep Katari
Nike Defend The Arch Ad - Golden Wolf - Boards by Randeep KatariNike Defend The Arch Ad - Golden Wolf - Boards by Randeep Katari
Nike Defend The Arch Ad - Golden Wolf - Boards by Randeep Katari
Randeep Katari
 
470195995-Millennials-assssssssssssssnd-Filinnials-Ethical-Challenges-and-Res...
470195995-Millennials-assssssssssssssnd-Filinnials-Ethical-Challenges-and-Res...470195995-Millennials-assssssssssssssnd-Filinnials-Ethical-Challenges-and-Res...
470195995-Millennials-assssssssssssssnd-Filinnials-Ethical-Challenges-and-Res...
JackAaronZambrano
 
_04 Template PPT.pptxttttttttttttttttttttttttttttttttttttttttttt
_04 Template PPT.pptxttttttttttttttttttttttttttttttttttttttttttt_04 Template PPT.pptxttttttttttttttttttttttttttttttttttttttttttt
_04 Template PPT.pptxttttttttttttttttttttttttttttttttttttttttttt
Doni43566
 
traffic_signal.pptx.ppthhahajjajakaakakaka
traffic_signal.pptx.ppthhahajjajakaakakakatraffic_signal.pptx.ppthhahajjajakaakakaka
traffic_signal.pptx.ppthhahajjajakaakakaka
pradeepmogili648
 
IDM Crack 6.42 Build 35 Patch + Serial Key Download [Latest]
IDM Crack 6.42 Build 35 Patch + Serial Key Download [Latest]IDM Crack 6.42 Build 35 Patch + Serial Key Download [Latest]
IDM Crack 6.42 Build 35 Patch + Serial Key Download [Latest]
ajahsan727727
 
Ad

Data Structure Introduction.pdfssssssssssss

  • 1. Department of Informatics & Software Engineering Data Structures Second Year- First Semester Academic Year: 2022-2023 Lecturer: Mr. Yazen Saifuldeen
  • 2. Introduction to Programming • Programming requires different kinds of information to be stored in the computer and the input data to be processed. The information can be stored in a generalized format using variables. In principle, one variable allows the storage of a single data entity. • Computer is a programmable data processor that accepts input and instructions to process the input (program) and generates the required output. • Computers are competent to perform complex and difficult operations, they are inherently simple and passive machines. They must be told precisely and explicitly in a language they can understand, as to what is to be done. • This sequence of instructions is known as a program. A program that satisfies user needs as per his/her specifications is called software. • The success of a software project often depends upon the choices made in the representation of the data (data structure).
  • 3. Introduction to Algorithms Algorithms : A programmer should first solve the problem in a step-by-step manner and then try to find the appropriate instruction or series of instructions that solves the problem. This step-by-step solution is called an algorithm. An algorithm is independent of the computer system and the programming language. Each algorithm includes steps for 1. input. 2. processing, and 3. output.
  • 4. The two popular tools used in the representation of algorithms are the following: 1. Pseudo code: An algorithm can be written in any of the natural languages such as English, German, French, etc. 2. Flowchart : A very effective tool to show the logic flow of a program is the flowchart. A flowchart is a pictorial representation of an algorithm. It hides all the details of an algorithm by giving a picture;
  • 5. Introduction to Data Structures • The term data structure refers to the organization of data elements and the interrelationships among them. • In the most general sense, a data structure is any data representation and its associated operations. The term “data structure” means an organization or structuring for a collection of data items. A sorted list of integers stored in an array is an example of such a structuring. • Structures is a set of rules that holds the data together. In other words, if we take a combination of data types and fit them into a structure such that we can define the relating rules, we can have data structures that consist of other data structures too. • Data is nothing but a piece of information. Data input, data manipulation (or data processing), and data output are the functions of computers. • Data structure can be also defined as a particular way of organizing data in a computer so that it can be retrieved and used efficiently.
  • 6. The Need for Data Structures “How many people in my company make over $100,000 per year? Can we connect all of our telephone customers with less than 1,000 miles of cable? “ —To answer questions like these, it is not enough to have the necessary information. We must organize that information in a way that allows us to find the answers in time to satisfy our needs.
  • 7. Different types of data structures
  • 8. Criteria to choose correct Data Structure: 1. The size of data will be used. 2. The way that data will be used. 3. How often the data will be changed. 4. The time required to access any information in the data structure. 5. Required capacity. 6. The programming language/ method will be used. Costs and Benefits • Each data structure has associated costs and benefits. In practice, it is hardly ever true that one data structure is better than another for use in all situations. • Data structure requires a certain amount of space for each data item it stores, a certain amount of time to perform a single basic operation, and a certain mount of programming effort.
  • 9. Operations that can be performed on data structures: 1. Traversing: It is used to access each data item exactly once so that it can be processed. 2. Searching: It is used to find out the location of the data item if it exists in the given collection of data items. 3. Inserting: It is used to add a new data item in the given collection of data items. 4. Deleting: It is used to delete an existing data item from the given collection of data items. 5. Sorting: It is used to arrange the data items in some order i.e. in ascending or descending order in case of numerical data and in dictionary order in case of alphanumeric data. 6. Merging: It is used to combine the data items of two sorted files into single file in the sorted form.
  • 10. Classification of data structure Data structures are broadly divided into two : 1. Primitive Data types: are the basic data types that are available in most of the programming languages. The primitive data types are used to represent single values like: • Integer: This is used to represent a number without decimal point. Example: 12, 90 • Float and Double: This is used to represent a number with decimal point. Example: 45.1, 67.3 • Character: This is used to represent single character Example: ‘C’, ‘a’ • String: This is used to represent group of characters. Example: "CIHAN University“ • Boolean: This is used represent logical values either true or false.
  • 11. 2. Non-Primitive Data types: are derived from primary data types and used to store group of values like: • Arrays • Tree • linked list • Stacks • Queue
  • 12. Linear and Nonlinear data structure Data can be organized in a linear or non-linear form: Linear Data Structure: Is the data structure that every element is linked with the next one sequentially. Since the data items are arranged in sequence. Samples of a linear data structure are the stack and the queue. Nonlinear data structure: is the data structure where the element may attach to more than one element and data items are not in sequence. A sample of nonlinear data structure is a tree.
  • 13. Storage Allocation It’s the way in which the data items are physically stored in the memory, so there are the following two types 1. Sequential allocation: it’s the simpler way in which the data items are stored in continuous memory allocations one by one. Arrays are the data types that are used to implement such types of storages. Sequential Allocation Advantages: • Easy to implement. • Less storage space. Sequential Allocation Disadvantages: • It needs a sequential free space in memory. • It required that we know previously the max number of items that will be used. • Over flow problem is occasionally occurs.
  • 14. 2. Dynamic Allocation: implementation of data structure is the dynamic linking; since there is no sequential allocation but every data item has the address of the next one instead. Here each data item will be called as “node”; this node will have two parts, one carried the required information and the other is for the next item address. Dynamic Allocation Advantages: • Easy to add or remove. • No over flow problem. • We do not need to specify the number of nodes previously. Dynamic Allocation Disadvantages: • More storage space for each data item, since each one must has a value and the information of the next address as well. • Complicated and hard to achieve random access.
  翻译: