SlideShare uma empresa Scribd logo
1 de 25
CS261
DATA STRUCTURES & ALGORITHMS
(WEEK-1)
LECTURE-1 & 2
INTRODUCTION TO DATA STRUCTURES & ALGORITHMS
Lecturer
Azka Aziz
Azka.a@scocs.edu.pk
2
 Assignment = 10% (Research review report)
 Quizzes = 20%
 Mid-Term = 30%
 Final Exam = 40%
 Week 1: Introduction to data structures, algorithm ,Pseudo code, Al-Khawarzmi’s Principle
Relation of algorithm with Data Structures Multiplication of numbers Multiplication Problem
with Iterative.
 Week 2: Array Data structure ,Multidimensional arrays, Dynamic Arrays, Link List
 Week 3: Double Link list , Insertion , Deletion, Insert after, Insert Before
 Week 4: More on Asymptotic Analysis Insertion Sort Merge Sort, Selection sort, Bubble Sort
 Week 5: Substitution Method Master Theorem Tree Method
 Week 6: Select Algorithm (Kth Smallest and Kth Largest Element) Quick Sort Difference From
Merge Sort
 Week 7: Sorting Lower Bounds and O(n) Sorting Radix Sort Counting Sort
 Week 8: Binary Search Tree using Array Binary Search Tree using linked
list
 Week 9: AVL Trees RB Tree using Linked List
 Week 10: Hashing Hash Functions Hash Tables
 Week 11: Stack using Link List, using Arrays
 Week 12: Queues using Link List, using Arrays
 Week 13: Graph Basics Graphs Representation Graph Types Basic Graphs
Algorithm
 Week 14: DFS BFS Strongly Connected Components Topological
Order
 Week 15: Minimum Spanning Tree
 Week 16: Shortest Path
 CLO1 Understand the fundamentals data structures such as lists,
queues, trees, etc.
 CLO2 Analyze time and space complexities of data structures and
algorithms
 CLO3 Select appropriate algorithms to use in specific applications
Data Structure = Data + Structure
“A specialize format to store data in a particular
organization”. Any data structure is designed to enable certain
operations in an efficient manner e.g. Queue is a data structure
that facilitates data items to be stored in a manner that supports
first come first serve order.
Similarly there are many data structures already designed to meet
certain objectives including Array, Stack, Tree, Graph etc.
“An algorithm is any well-defined computational procedure that takes
some values, or set of values, as input and produces some value, or set of
values, as output”
 Algorithm is basic element of programming
 A mathematical entity independent of programming languages,
operating system & compiler
 Algorithms provide a scientific way of handling general programming
techniques
 Given any input values, an algorithm will definitely terminate after
executing a finite number of steps
“A data container whose contents can vary”
Say a variable ‘radius’ is defined as integer using any
programming language in a program then its value can
be changed as the result of assignment within the
lifetime of that variable when that variable is in scope
“A data type is a classification of data that tells the compiler or
interpreter how the variables (declared with that data type) will
be used”
Every data type allows a certain type of data values (and
forbids other types) e.g. typically a data type ‘int’ allows
numerical values without decimal points with a certain range
while not allowing string data
All variables defined with same data type will have same
range and permitted data
“An abstract data type (ADT) is a set of elements
with a collection of well defined set of operations”
Said operations can take the same ADT instances
as well as other ADT instances as operands
Operation results may not be instances of same
ADT
Java / C++ allows ADTs by means of classes
Data Structure = Data + Structure
“A specialize format to store data in a particular
organization”. Any data structure is designed to enable certain
operations in an efficient manner e.g. Queue is a data structure
that facilitates data items to be stored in a manner that supports
first come first serve order.
Similarly there are many data structures already designed to
meet certain objectives including Array, Stack, Tree, Graph etc.
“An implementation of an ADT using a
programming language is called a data structure”
Data structure includes data items stored
Data structure also includes implementation of
all operations within the data structure
A data structure allows different operations in an
efficient way but it certainly has its cost
Time Vs. Space complexity
Trying to achieve efficiency in one operation may
make other operations less efficient
Generality may not be achieved
While enabling certain operations, simplicity may be
compromised
While designing a data structure, following questions
should be asked:
Does this data structure support the required
operations efficiently?
Will it be easier to implement in our desired
programming language?
Will be easier to debug?
What are the possibilities for its usage?
What operands should it support?
 What is a Static Data structure?
In Static data structure the size of the structure is fixed. The
content of the data structure can be modified but without
changing the memory space allocated to it. Example Array
 In Dynamic data structure the size of the structure in not
fixed and can be modified during the operations performed
on it. Dynamic data structures are designed to facilitate
change of data structures in the run time. Example: Link List
 Linear Data Structure:
Data structure where data elements are arranged sequentially
or linearly where each and every element is attached to its
previous and next adjacent is called a linear data structure. In
linear data structure, single level is involved. Therefore, we
can traverse all the elements in single run only. Linear data
structures are easy to implement because computer memory
is arranged in a linear way. Its examples
are array, stack, queue, linked list, etc.
Non-linear Data Structure:
Data structures where data
elements are not arranged sequentially or linearly are
called non-linear data structures. In a non-linear
data structure, single level is not involved. Therefore,
we can’t traverse all the elements in single run only.
Non-linear data structures are not easy to implement
in comparison to linear data structure. It utilizes
computer memory efficiently in comparison to a
linear data structure. Its examples
are trees and graphs.
 Physical Data Structure:
The Array and Link List are the two physical data structures. We can have
more physical data structures by taking the combination of these two data
structures i.e. array and linked list.
 Logical Data Structure:
Physical data structures are actually meant for storing the data in the
memory. Then on the stored data or values, we may be performing some
operations like inserting more values or deleting existing values or
searching for the values, and many more operations. Now, the question is,
how you want to utilize those values? How you will be performing
insertion and deletion? What is the discipline that you are going to follow?
That discipline is defined by logical data structures i.e. stack, queues, trees,
graphs, and hash table.
 Al-Khwarizmi left a golden rule for the world to create science with. The al-Khwarizmi
principle states that all complex problems of science must be and can be solved by means of
the following five simple steps:
1. Break down each problem into a number of elemental or ‘atomic’ steps. An elemental or
atomic step is one, which cannot be simplified any further.
2. Second, arrange all the elements or steps of the problem in an order or sequence, such that
each element can be taken up and solved one at a time, without affecting other parts of the
problem.
3. Next, find a way to solve each of the elements separately. Because each element has been
simplified to the maximum, it is very likely that the solution of an elemental step will itself be
extremely simple or elemental making it available with relative ease.
4. Then proceed to solve each element of the problem, either one at a time or several at a time,
but in the correct order. Thus, when all steps are solved, the original problem itself has also
been solved.
 Pseudocode is the expressive form of the algorithm or a way to describe
an algorithm.
 It is a combination of natural language and high-level programming
practices which represent the fundamental concept behind a general
implementation of a data structure or algorithm.
 Pseudocode incorporated the natural language when the details are
insignificant with the standard programming language constructs to
obtain more clarity. However, we can not execute pseudocode on a
computer, but it models the actual programming code along with a
similar level of detail.
Pseudocode is also written using some specific words and
characters, which are shown below:
1. To begin the comment double forward slash are used “//“.
2. Matching braces “{ and }” are used to present blocks where a compound
statement (set of simple statements) can be illustrated as a block and
terminated by a semicolon”;“. The body of a procedure constructs a block
as well.
3. All the identifiers start with a letter and the datatype of the variables are
not declared explicitly.
4. An assignment statement is used for the assigning values to the variables.
5. To produce the boolean values (i.e., true and false) the logical operators
and, or and not and the relational operators <, ≤, =, =, ≥ and > are
provided.
6. Input and output are presented by read and write instructions.
7. “if and then” expressions are used to express a conditional statement.
 An algorithm is a definite, clear sequence-wise procedure to solve a
problem. It involves the high-level language builds which cannot be
understood by a non-technical person. On the other hand, pseudocode is
a more plain and human understandable form of algorithm where
natural language is also combined with the high-level programming
language constructs.
 Pseudocode is easy to understand and interpret as compared to an
algorithm.
 The algorithm uses high-level constructs meaning the snippet of code
but the pseudocode involves natural language with high-level
programming builds.
 Pseudocode is easily constructed and debugged relative to the
algorithm.

Mais conteúdo relacionado

Semelhante a Data Structure.pptx

Mca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structureMca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structureRai University
 
Bca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureBca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureRai University
 
Bsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structureBsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structureRai University
 
DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS Adams Sidibe
 
Data structures cs301 power point slides lecture 01
Data structures   cs301 power point slides lecture 01Data structures   cs301 power point slides lecture 01
Data structures cs301 power point slides lecture 01shaziabibi5
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfkarymadelaneyrenne19
 
computer notes - Circular list
computer notes - Circular listcomputer notes - Circular list
computer notes - Circular listecomputernotes
 
Data Analysis – Technical learnings
Data Analysis – Technical learningsData Analysis – Technical learnings
Data Analysis – Technical learningsInvenkLearn
 
Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Tutort Academy
 

Semelhante a Data Structure.pptx (20)

Data structure
Data structureData structure
Data structure
 
Mca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structureMca ii dfs u-1 introduction to data structure
Mca ii dfs u-1 introduction to data structure
 
Bca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structureBca ii dfs u-1 introduction to data structure
Bca ii dfs u-1 introduction to data structure
 
Bsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structureBsc cs ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structure
 
DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS
 
Data structures cs301 power point slides lecture 01
Data structures   cs301 power point slides lecture 01Data structures   cs301 power point slides lecture 01
Data structures cs301 power point slides lecture 01
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
 
Datastructures Notes
Datastructures NotesDatastructures Notes
Datastructures Notes
 
CSE 443 (1).pptx
CSE 443 (1).pptxCSE 443 (1).pptx
CSE 443 (1).pptx
 
computer notes - Circular list
computer notes - Circular listcomputer notes - Circular list
computer notes - Circular list
 
Database system
Database system Database system
Database system
 
Data structures in c#
Data structures in c#Data structures in c#
Data structures in c#
 
Lecture 1 and 2
Lecture 1 and 2Lecture 1 and 2
Lecture 1 and 2
 
Data Analysis – Technical learnings
Data Analysis – Technical learningsData Analysis – Technical learnings
Data Analysis – Technical learnings
 
8.unit-1-fds-2022-23.pptx
8.unit-1-fds-2022-23.pptx8.unit-1-fds-2022-23.pptx
8.unit-1-fds-2022-23.pptx
 
Data models
Data modelsData models
Data models
 
Data models
Data modelsData models
Data models
 
Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...
 
Intro ds
Intro dsIntro ds
Intro ds
 
UNIT I - Data Structures.pdf
UNIT I - Data Structures.pdfUNIT I - Data Structures.pdf
UNIT I - Data Structures.pdf
 

Mais de SajalFayyaz

Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptxSajalFayyaz
 
Data structure.ppt
Data structure.pptData structure.ppt
Data structure.pptSajalFayyaz
 
data structure 9.pptx
data structure 9.pptxdata structure 9.pptx
data structure 9.pptxSajalFayyaz
 
Data structure 8.pptx
Data structure 8.pptxData structure 8.pptx
Data structure 8.pptxSajalFayyaz
 
Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptxSajalFayyaz
 
Data structure 6.pptx
Data structure 6.pptxData structure 6.pptx
Data structure 6.pptxSajalFayyaz
 
Data Structure.pptx
Data Structure.pptxData Structure.pptx
Data Structure.pptxSajalFayyaz
 
Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptxSajalFayyaz
 
data structure3.pptx
data structure3.pptxdata structure3.pptx
data structure3.pptxSajalFayyaz
 
Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptxSajalFayyaz
 

Mais de SajalFayyaz (10)

Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptx
 
Data structure.ppt
Data structure.pptData structure.ppt
Data structure.ppt
 
data structure 9.pptx
data structure 9.pptxdata structure 9.pptx
data structure 9.pptx
 
Data structure 8.pptx
Data structure 8.pptxData structure 8.pptx
Data structure 8.pptx
 
Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptx
 
Data structure 6.pptx
Data structure 6.pptxData structure 6.pptx
Data structure 6.pptx
 
Data Structure.pptx
Data Structure.pptxData Structure.pptx
Data Structure.pptx
 
Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptx
 
data structure3.pptx
data structure3.pptxdata structure3.pptx
data structure3.pptx
 
Data structure.pptx
Data structure.pptxData structure.pptx
Data structure.pptx
 

Último

Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 

Último (20)

Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 

Data Structure.pptx

  • 1. CS261 DATA STRUCTURES & ALGORITHMS (WEEK-1) LECTURE-1 & 2 INTRODUCTION TO DATA STRUCTURES & ALGORITHMS Lecturer Azka Aziz Azka.a@scocs.edu.pk
  • 2. 2  Assignment = 10% (Research review report)  Quizzes = 20%  Mid-Term = 30%  Final Exam = 40%
  • 3.  Week 1: Introduction to data structures, algorithm ,Pseudo code, Al-Khawarzmi’s Principle Relation of algorithm with Data Structures Multiplication of numbers Multiplication Problem with Iterative.  Week 2: Array Data structure ,Multidimensional arrays, Dynamic Arrays, Link List  Week 3: Double Link list , Insertion , Deletion, Insert after, Insert Before  Week 4: More on Asymptotic Analysis Insertion Sort Merge Sort, Selection sort, Bubble Sort  Week 5: Substitution Method Master Theorem Tree Method  Week 6: Select Algorithm (Kth Smallest and Kth Largest Element) Quick Sort Difference From Merge Sort
  • 4.  Week 7: Sorting Lower Bounds and O(n) Sorting Radix Sort Counting Sort  Week 8: Binary Search Tree using Array Binary Search Tree using linked list  Week 9: AVL Trees RB Tree using Linked List  Week 10: Hashing Hash Functions Hash Tables  Week 11: Stack using Link List, using Arrays  Week 12: Queues using Link List, using Arrays  Week 13: Graph Basics Graphs Representation Graph Types Basic Graphs Algorithm
  • 5.  Week 14: DFS BFS Strongly Connected Components Topological Order  Week 15: Minimum Spanning Tree  Week 16: Shortest Path
  • 6.  CLO1 Understand the fundamentals data structures such as lists, queues, trees, etc.  CLO2 Analyze time and space complexities of data structures and algorithms  CLO3 Select appropriate algorithms to use in specific applications
  • 7. Data Structure = Data + Structure “A specialize format to store data in a particular organization”. Any data structure is designed to enable certain operations in an efficient manner e.g. Queue is a data structure that facilitates data items to be stored in a manner that supports first come first serve order. Similarly there are many data structures already designed to meet certain objectives including Array, Stack, Tree, Graph etc.
  • 8. “An algorithm is any well-defined computational procedure that takes some values, or set of values, as input and produces some value, or set of values, as output”  Algorithm is basic element of programming  A mathematical entity independent of programming languages, operating system & compiler  Algorithms provide a scientific way of handling general programming techniques  Given any input values, an algorithm will definitely terminate after executing a finite number of steps
  • 9. “A data container whose contents can vary” Say a variable ‘radius’ is defined as integer using any programming language in a program then its value can be changed as the result of assignment within the lifetime of that variable when that variable is in scope
  • 10. “A data type is a classification of data that tells the compiler or interpreter how the variables (declared with that data type) will be used” Every data type allows a certain type of data values (and forbids other types) e.g. typically a data type ‘int’ allows numerical values without decimal points with a certain range while not allowing string data All variables defined with same data type will have same range and permitted data
  • 11. “An abstract data type (ADT) is a set of elements with a collection of well defined set of operations” Said operations can take the same ADT instances as well as other ADT instances as operands Operation results may not be instances of same ADT Java / C++ allows ADTs by means of classes
  • 12. Data Structure = Data + Structure “A specialize format to store data in a particular organization”. Any data structure is designed to enable certain operations in an efficient manner e.g. Queue is a data structure that facilitates data items to be stored in a manner that supports first come first serve order. Similarly there are many data structures already designed to meet certain objectives including Array, Stack, Tree, Graph etc.
  • 13. “An implementation of an ADT using a programming language is called a data structure” Data structure includes data items stored Data structure also includes implementation of all operations within the data structure
  • 14. A data structure allows different operations in an efficient way but it certainly has its cost Time Vs. Space complexity Trying to achieve efficiency in one operation may make other operations less efficient Generality may not be achieved While enabling certain operations, simplicity may be compromised
  • 15. While designing a data structure, following questions should be asked: Does this data structure support the required operations efficiently? Will it be easier to implement in our desired programming language? Will be easier to debug? What are the possibilities for its usage? What operands should it support?
  • 16.
  • 17.  What is a Static Data structure? In Static data structure the size of the structure is fixed. The content of the data structure can be modified but without changing the memory space allocated to it. Example Array
  • 18.  In Dynamic data structure the size of the structure in not fixed and can be modified during the operations performed on it. Dynamic data structures are designed to facilitate change of data structures in the run time. Example: Link List
  • 19.  Linear Data Structure: Data structure where data elements are arranged sequentially or linearly where each and every element is attached to its previous and next adjacent is called a linear data structure. In linear data structure, single level is involved. Therefore, we can traverse all the elements in single run only. Linear data structures are easy to implement because computer memory is arranged in a linear way. Its examples are array, stack, queue, linked list, etc.
  • 20. Non-linear Data Structure: Data structures where data elements are not arranged sequentially or linearly are called non-linear data structures. In a non-linear data structure, single level is not involved. Therefore, we can’t traverse all the elements in single run only. Non-linear data structures are not easy to implement in comparison to linear data structure. It utilizes computer memory efficiently in comparison to a linear data structure. Its examples are trees and graphs.
  • 21.  Physical Data Structure: The Array and Link List are the two physical data structures. We can have more physical data structures by taking the combination of these two data structures i.e. array and linked list.  Logical Data Structure: Physical data structures are actually meant for storing the data in the memory. Then on the stored data or values, we may be performing some operations like inserting more values or deleting existing values or searching for the values, and many more operations. Now, the question is, how you want to utilize those values? How you will be performing insertion and deletion? What is the discipline that you are going to follow? That discipline is defined by logical data structures i.e. stack, queues, trees, graphs, and hash table.
  • 22.  Al-Khwarizmi left a golden rule for the world to create science with. The al-Khwarizmi principle states that all complex problems of science must be and can be solved by means of the following five simple steps: 1. Break down each problem into a number of elemental or ‘atomic’ steps. An elemental or atomic step is one, which cannot be simplified any further. 2. Second, arrange all the elements or steps of the problem in an order or sequence, such that each element can be taken up and solved one at a time, without affecting other parts of the problem. 3. Next, find a way to solve each of the elements separately. Because each element has been simplified to the maximum, it is very likely that the solution of an elemental step will itself be extremely simple or elemental making it available with relative ease. 4. Then proceed to solve each element of the problem, either one at a time or several at a time, but in the correct order. Thus, when all steps are solved, the original problem itself has also been solved.
  • 23.  Pseudocode is the expressive form of the algorithm or a way to describe an algorithm.  It is a combination of natural language and high-level programming practices which represent the fundamental concept behind a general implementation of a data structure or algorithm.  Pseudocode incorporated the natural language when the details are insignificant with the standard programming language constructs to obtain more clarity. However, we can not execute pseudocode on a computer, but it models the actual programming code along with a similar level of detail.
  • 24. Pseudocode is also written using some specific words and characters, which are shown below: 1. To begin the comment double forward slash are used “//“. 2. Matching braces “{ and }” are used to present blocks where a compound statement (set of simple statements) can be illustrated as a block and terminated by a semicolon”;“. The body of a procedure constructs a block as well. 3. All the identifiers start with a letter and the datatype of the variables are not declared explicitly. 4. An assignment statement is used for the assigning values to the variables. 5. To produce the boolean values (i.e., true and false) the logical operators and, or and not and the relational operators <, ≤, =, =, ≥ and > are provided. 6. Input and output are presented by read and write instructions. 7. “if and then” expressions are used to express a conditional statement.
  • 25.  An algorithm is a definite, clear sequence-wise procedure to solve a problem. It involves the high-level language builds which cannot be understood by a non-technical person. On the other hand, pseudocode is a more plain and human understandable form of algorithm where natural language is also combined with the high-level programming language constructs.  Pseudocode is easy to understand and interpret as compared to an algorithm.  The algorithm uses high-level constructs meaning the snippet of code but the pseudocode involves natural language with high-level programming builds.  Pseudocode is easily constructed and debugged relative to the algorithm.