This document provides an introduction to data structures. It defines data structures as a way of organizing and storing data in a computer so it can be used efficiently. There are two main types: primitive data structures like integers and characters that are directly operated on by the CPU, and non-primitive structures like arrays and linked lists that are more complex. Key aspects of data structures covered include operations, properties, performance analysis using time and space complexity, and examples of linear structures like arrays and non-linear structures like trees. Common algorithms are analyzed based on their asymptotic worst-case running times.
Data may be organized in many different ways; the logical or mathematical model of a particular organization of data is called "Data Structure". The choice of a particular data model depends on two considerations:
It must be rich enough in structure to reflect the actual relationships of the data in the real world.
The structure should be simple enough that one can effectively process the data when necessary.
Data Structure Operations
The particular data structure that one chooses for a given situation depends largely on the nature of specific operations to be performed.
The following are the four major operations associated with any data structure:
i. Traversing : Accessing each record exactly once so that certain items in the record may be processed.
ii. Searching : Finding the location of the record with a given key value, or finding the locations of all records which satisfy one or more conditions.
iii. Inserting : Adding a new record to the structure.
iv. Deleting : Removing a record from the structure.
Primitive and Composite Data Types
Primitive Data Types are Basic data types of any language. In most computers these are native to the machine's hardware.
Some Primitive data types are:
Integer
This PPT is for First year engineering student,It covered all about C Programming according to Rajastha Technical University Kota.
flowchart, pseudo code, Programming Languages and Language Translators, Identifiers, Constants, Variables, Basic Data Types, Operators, Expressions, type casting, Input / Output Statement, Scope Rules and Storage classes, Preprocessor and Macro Substitution.
Data Structure Introduction
Data Structure Definition
Data Structure Types
Data Structure Characteristics
Need for Data Structure
Stack Definition
Stack Representation
Stack Operations
Stack Algorithm
Program for Stack in C++
Linked List Definition
Linked List Representation
Linked List Operations
Linked List Algorithm
Program for Linked List in C++
Linked List Defination
Linked List Representation
Linked List Operations
Linked List Algorithm
Program for Linked List in C++
Data may be organized in many different ways; the logical or mathematical model of a particular organization of data is called "Data Structure". The choice of a particular data model depends on two considerations:
It must be rich enough in structure to reflect the actual relationships of the data in the real world.
The structure should be simple enough that one can effectively process the data when necessary.
Data Structure Operations
The particular data structure that one chooses for a given situation depends largely on the nature of specific operations to be performed.
The following are the four major operations associated with any data structure:
i. Traversing : Accessing each record exactly once so that certain items in the record may be processed.
ii. Searching : Finding the location of the record with a given key value, or finding the locations of all records which satisfy one or more conditions.
iii. Inserting : Adding a new record to the structure.
iv. Deleting : Removing a record from the structure.
Primitive and Composite Data Types
Primitive Data Types are Basic data types of any language. In most computers these are native to the machine's hardware.
Some Primitive data types are:
Integer
This PPT is for First year engineering student,It covered all about C Programming according to Rajastha Technical University Kota.
flowchart, pseudo code, Programming Languages and Language Translators, Identifiers, Constants, Variables, Basic Data Types, Operators, Expressions, type casting, Input / Output Statement, Scope Rules and Storage classes, Preprocessor and Macro Substitution.
Data Structure Introduction
Data Structure Definition
Data Structure Types
Data Structure Characteristics
Need for Data Structure
Stack Definition
Stack Representation
Stack Operations
Stack Algorithm
Program for Stack in C++
Linked List Definition
Linked List Representation
Linked List Operations
Linked List Algorithm
Program for Linked List in C++
Linked List Defination
Linked List Representation
Linked List Operations
Linked List Algorithm
Program for Linked List in C++
Data Structures, which is also called as Abstract Data Types (ADT) provide powerful options for programmer. Here is a tutorial which talks about various ADTs - Linked Lists, Stacks, Queues and Sorting Algorithms
Array
Introduction
One-dimensional array
Multidimensional array
Advantage of Array
Write a C program using arrays that produces the multiplication of two matrices.
Everything about OOPs (Object-oriented programming) in this slide we cover the all details about object-oriented programming using C++. we also discussed why C++ is called a subset of C.
https://github.com/ashim888/dataStructureAndAlgorithm
Stack
Concept and Definition
• Primitive Operations
• Stack as an ADT
• Implementing PUSH and POP operation
• Testing for overflow and underflow conditions
Recursion
• Concept and Definition
• Implementation of:
¬ Multiplication of Natural Numbers
¬ Factorial
¬ Fibonacci Sequences
The Tower of Hanoi
Data Structures, which is also called as Abstract Data Types (ADT) provide powerful options for programmer. Here is a tutorial which talks about various ADTs - Linked Lists, Stacks, Queues and Sorting Algorithms
Array
Introduction
One-dimensional array
Multidimensional array
Advantage of Array
Write a C program using arrays that produces the multiplication of two matrices.
Everything about OOPs (Object-oriented programming) in this slide we cover the all details about object-oriented programming using C++. we also discussed why C++ is called a subset of C.
https://github.com/ashim888/dataStructureAndAlgorithm
Stack
Concept and Definition
• Primitive Operations
• Stack as an ADT
• Implementing PUSH and POP operation
• Testing for overflow and underflow conditions
Recursion
• Concept and Definition
• Implementation of:
¬ Multiplication of Natural Numbers
¬ Factorial
¬ Fibonacci Sequences
The Tower of Hanoi
Rai University provides high quality education for MSc, Law, Mechanical Engineering, BBA, MSc, Computer Science, Microbiology, Hospital Management, Health Management and IT Engineering.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
What is the purpose of the Sabbath Law in the Torah. It is interesting to compare how the context of the law shifts from Exodus to Deuteronomy. Who gets to rest, and why?
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
How to Create Map Views in the Odoo 17 ERPCeline George
The map views are useful for providing a geographical representation of data. They allow users to visualize and analyze the data in a more intuitive manner.
The Indian economy is classified into different sectors to simplify the analysis and understanding of economic activities. For Class 10, it's essential to grasp the sectors of the Indian economy, understand their characteristics, and recognize their importance. This guide will provide detailed notes on the Sectors of the Indian Economy Class 10, using specific long-tail keywords to enhance comprehension.
For more information, visit-www.vavaclasses.com
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxEduSkills OECD
Andreas Schleicher presents at the OECD webinar ‘Digital devices in schools: detrimental distraction or secret to success?’ on 27 May 2024. The presentation was based on findings from PISA 2022 results and the webinar helped launch the PISA in Focus ‘Managing screen time: How to protect and equip students against distraction’ https://www.oecd-ilibrary.org/education/managing-screen-time_7c225af4-en and the OECD Education Policy Perspective ‘Students, digital devices and success’ can be found here - https://oe.cd/il/5yV
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
2. Data Structure
A Data Structure is an aggregation of atomic and
composite data into a set with defined relationships.
Structure means a set of rules that holds the data together.
Taking a combination of data and fit them into such a
structure that we can define its relating rules, we create a
data structure.
3. Data structure
A data structure in computer science is a way of
storing data in a computer so that it can be used
efficiently.
– An organization of mathematical and logical
concepts of data
– Implementation using a programming language
– A proper data structure can make the algorithm or
solution more efficient in terms of time and space
4. Data Structures: Properties
Most of the modern programming languages support
a number of data structures.
In addition, modern programming languages allow
programmers to create new data structures for an
application.
Data structures can be nested.
A data structure may contain other data structures
(array of arrays, array of records, record of records,
record of arrays, etc.)
5. What is Data Structures?
A data structure is defined by
(1) the logical arrangement of data elements,
combined with
(2) the set of operations we need to access the
elements.
6. What is Data Structures?
Example:
library is composed of elements (books)
Accessing a particular book requires knowledge
of the arrangement of the books
Users access books only through the librarian
7. Cont..
An algorithm is a finite set of instructions that, if
followed, accomplishes a particular task.
All the algorithms must satisfy the following criteria:
– Input
– Output
– Precision (Definiteness)
– Effectiveness
– Finiteness
8. TYPES OF DATA STRUCURE
Primitive & Non Primitive Data Structures
Primitive data Structure
The integers, reals, logical data, character data,
pointer and reference are primitive data structures.
Data structures that normally are directly operated
upon by machine-level instructions are known as
primitive data structures.
9. Non-primitive Data Structures
These are more complex data structures. These data
structures are derived from the primitive data
structures.
They stress on formation of sets of homogeneous and
heterogeneous data elements.
The different operations that are to be carried out on
data are nothing but designing of data structures.
CREATE
DESTROY
SELECT
UPDATE
11. Performance Analysis
There are problems and algorithms to solve them.
Problems and problem instances.
Example: Sorting data in ascending order.
Problem: Sorting
Problem Instance: e.g. sorting data (2 3 9 5 6 8)
Algorithms: Bubble sort, Merge sort, Quick sort,
Selection sort, etc.
Which is the best algorithm for the problem? How do
we judge?
12. Performance Analysis
Two criteria are used to judge algorithms:
(i) time complexity (ii) space complexity.
Space Complexity of an algorithm is the amount of
memory it needs to run to completion.
Time Complexity of an algorithm is the amount of
CPU time it needs to run to completion.
13. Space Complexity: Example 1
1. Algorithm abc (a, b, c)
2. {
3. return a+b+b*c+(a+b-c)/(a+b)+4.0;
4. }
For every instance 3 computer words required to
store variables: a, b, and c.
Therefore Sp()= 3. S(P) = 3.
14. Time Complexity
What is a program step?
a+b+b*c+(a+b)/(a-b) one step;
comments zero steps;
while (<expr>) do step count equal to the
number of times <expr> is executed.
for i=<expr> to <expr1> do step count equal to
number of times <expr1> is checked.
15. Performance Measurement
Which is better?
T(P1) = (n+1) or T(P2) = (n2 + 5).
T(P1) = log (n2 + 1)/n! or T(P2) = nn(nlogn)/n2.
Complex step count functions are difficult to compare.
For comparing, ‘rate of growth’ of time and space
complexity functions is easy and sufficient.
16. Big O Notation
Big O of a function gives us ‘rate of growth’ of the
step count function f(n), in terms of a simple function
g(n), which is easy to compare.
Definition:
[Big O] The function f(n) = O(g(n)) (big ‘oh’ of g of
n) if
there exist positive constants c and n0 such that f(n) <=
c*g(n) for all n, n>=n0. See graph on next slide.
Example: f(n) = 3n+2 is O(n) because 3n+2 <= 4n for
all n >= 2. c = 4, n0 = 2. Here g(n) = n.
18. Big O Notation
Example: f(n) = 10n2+4n+2 is O(n2)
because 10n2+4n+2 <= 11n2 for all n >=5.
Example: f(n) = 6*2n+n2 is O(2n)
because 6*2n+n2 <=7*2n for all n>=4.
Algorithms can be:
O(1) constant; O(log n) logrithmic; O(nlogn);
O(n) linear; O(n2) quadratic; O(n3) cubic; O(2n)
exponential.
19. Big O Notation
Now it is easy to compare time or space complexities
of algorithms.
Which algorithm complexity is better?
T(P1) = O(n) or T(P2) = O(n2)
T(P1) = O(1) or T(P2) = O(log n)
T(P1) = O(2n) or T(P2) = O(n10)
20. Linear & Non Linear Data Structures
Linear data structures:- in which insertion and deletion
is possible in linear fashion .
example:- arrays, linked lists.
Non linear data structures:-in which it is not possible.
example:- trees ,stacks
21. LINEAR DATA STRUCTURE Array
Array is linear, homogeneous data structures whose
elements are stored in contiguous memory locations.
22. Arrays
Array: a set of pairs, <index, value>
Data structure
For each index, there is a value associated with
that index.
Representation (possible)
Implemented by using consecutive memory.
In mathematical terms, we call this a
correspondence or a mapping.
23. Initializing Arrays
Using a loop:
for (int i = 0; i < myList.length; i++)
myList[i] = i;
Declaring, creating, initializing in one step:
double[] myList = {1.9, 2.9, 3.4, 3.5};
This shorthand syntax must be in one statement.
24. Declaring and Creating in One Step
datatype[] arrayname = new
datatype[arraySize];
double[] myList = new double[10];
datatype arrayname[] = new
datatype[arraySize];
double myList[] = new double[10];
25. Sparse Matrix[2]
A sparse matrix is a matrix that has many zero entries.
0002800
0000091
000000
006000
0003110
150220015
• This is a __×__ matrix.
• There are _____ entries.
• There are _____ nonzero entries.
• There are _____ zero entries.
Consider we use a 2D array to represent a n×n sparse matrix. How many entries
are required? _____ entries. The space complexity is O( ).
26. Sparse Matrix
If n is large, say n = 5000, we need 25 million elements to store
the matrix.
25 million units of time for operation such as addition and
transposition.
Using a representation that stores only the nonzero entries can
reduce the space and time requirements considerably.
27. Sparse Matrix Representation
The information we need to know
The number of rows
The number of columns
The number of nonzero entries
All the nonzero entries are stored in an array. Therefore, we
also have to know
The capacity of the array
Each element contains a triple <row, col, value> to store.
The triples are ordered by rows and within rows by
columns.
28. Sparse Matrix Representation
class SparseMatrix;
class MatrixEntry {
friend class SparseMatrix;
private:
int row, col, value;
};
class SparseMatrix {
private:
int rows, cols, terms, capacity;
MatrixEntry *smArray;
};
29. The array as an ADT
When considering an ADT we are more concerned
with the operations that can be performed on an array.
Aside from creating a new array, most languages
provide only two standard operations for arrays,
one that retrieves a value, and a second that stores
a value.
The advantage of this ADT definition is that it
clearly points out the fact that the array is a more
general structure than “a consecutive set of
memory locations.”
31. Tower of Hanoi[3]
The Objective is to transfer the entire tower to one of
the other pegs.
However you can only move one disk at a time and
you can never stack a larger disk onto a smaller disk.
Try to solve it in fewest possible moves.
33. References
1) An introduction to Datastructure with application by jean Trembley and
sorrenson
2) Data structures by schaums and series –seymour lipschutz
3) http://en.wikipedia.org/wiki/Book:Data_structures
4) http://www.amazon.com/Data-Structures-Algorithms
5) http://www.amazon.in/Data-Structures-Algorithms-Made-
Easy/dp/0615459811/
6) http://www.amazon.in/Data-Structures-SIE-Seymour-Lipschutz/dp
List of Images
1. Data structures by schaums and series –seymour lipschutz
2. http://en.wikipedia.org/wiki/Book:Data_structures
3. http://en.wikipedia.org/wiki/tower of hanoi
4. http://en.wikipedia.org/wiki/tower of hanoi