SlideShare a Scribd company logo
3
Most read
4
Most read
13
Most read
Unit 1
Concept and Definition of
Data Structures
Ashim Lamichhane 1
Goal
• As computers become faster and faster, the need for programs that can
handle large amounts of input becomes more acute.
• This requires more careful attention to efficiency, since inefficiencies in
programs become most obvious when input sizes are large.
• By analyzing an algorithm before it is actually coded, we can decide if
a particular solution will be feasible.
• The goal is to develop good programming and algorithm analysis skills
simultaneously so that we can develop such programs with the maximum
amount of efficiency.
Ashim Lamichhane 2
Objective
• To identify and create useful mathematical entities to determine what
classes of problems can be solved by using these entities and
operations.
• To determine the representations of these abstract entities and to
implement the abstract operations on these concrete representations.
Ashim Lamichhane 3
Introduction to the theory of DATA STRUCTURE
• It’s a branch of computer science that unleashes the knowledge of
• how data should organized,
• how the flow of data should be controlled and
• how data structure should be designed and implemented to reduce the
complexity and increase the efficiency of the algorithm.
• It enables you to design and implement various data structure, for
example, the stacks, queues, linked lists, trees and graphs.
• Effective use of principles of data structures increases efficiency of
algorithms to solve problems like searching, sorting, populating and
handling huge set of data.
Ashim Lamichhane 4
Need of a Data Structure
• A data structure helps you to understand the relationship of one data
element with the other and organize it within the memory.
• Consider an example, list of names of months in a year.
• Similarly consider a set of data that represents location of historical
places in a country.
• Such data form a hierarchical relationship between them and must be
represented in the memory using a hierarchical type of data structure
Ashim Lamichhane 5
Nepal
ktm bkt LLt
pashupati baglamukhi suryabinayak
Mahabauddha
temple
Krishna mandir
Fig. hierarchical representation
Ashim Lamichhane 6
Data structures are widely applied in areas like
• Compiler design
• Operating system
• Statistical analysis package
• DBMS
• Numerical analysis
• Simulation
• Artificial Intelligence
• Graphics
Ashim Lamichhane 7
Arrays
• One dimensional array can be represented either as a single column or
as single row.
• Following are some valid array declarations:
• Int age[15];
• Float weight[40];
• Following are some invalid array declarations in c:
• Int value[0];
• Int marks[0.5];
• Int number[-5];
Ashim Lamichhane 8
Some common operation performed in 1D array
• Creating an array
• Inserting new element at required position
• Deletion of any array element
• Modification of any element
• Traversing of an array
• Merging of arrays
Ashim Lamichhane 9
CODE SAMPLE CHECK
• FOLLOW THE LINK
https://github.com/ashim888/dataStructureAndAlgorithm/blob/master/
codes/shift_pos.c
Ashim Lamichhane 10
ASSIGNMENT AT FOLLOWING LINK
https://github.com/ashim888/dataStructureAndAlgorithm/tree/master/
Assignments/assignment_3
Ashim Lamichhane 11
Implementation of a two dimensional array
• A two dimensional array can be implemented in a programming
language in two ways:
• Row Major Implementation
• Column Major Implementation
Ashim Lamichhane 12
Row Major Implementation
• Row-major implementation is a linearization technique in which
elements of array are readers from the keyboard row-wise
• The complete first row is stored and then the complete second row is
stored.
• For example, an array a[3][3] is stored in the memory as shown in fig
below:
Ashim Lamichhane 13
Column Major Implementation
• In column major implementation memory allocation is done column
by column i.e. at first the elements of the complete first column is
stored, and then elements of complete second column is stored, and
so on.
• For example an array a [3] [3] is stored in the memory as shown in the
fig below:
Ashim Lamichhane 14
Multi-Dimensional array
• C also allows arrays with more than two dimensions. For example, a
three dimensional array may be declared by
int a[3][2][4]
• Here, the first subscript specifies a plane number, the second subscript
a row number and the third a column number.
Ashim Lamichhane 15
Multi-Dimensional array
Fig. Representation of array a[3][2][4]
Ashim Lamichhane 16
Multi-Dimensional array
Ashim Lamichhane 17
Abstract Data Types (ADT)
• We are well acquainted with data types by now, like integers, arrays,
and so on.
• To access the data, we've used operations defined in the programming
language for the data type, for instance by accessing array elements by
using the square bracket notation.
• An abstract data type is a data type whose representation is hidden
from, and of no concern to the application code.
Ashim Lamichhane 18
Abstract Data Types (ADT)
• For example, when writing application code, we don’t care how strings
are represented: we just declare variables of type string, and
manipulate them by using string operations.
• Once an abstract data type has been designed, the programmer
responsible for implementing that type is concerned only with
choosing a suitable data structure and coding up the methods.
• On the other hand, application programmers are concerned only with
using that type and calling its methods without worrying much about
how the type is implemented.
Ashim Lamichhane 19
ADT conclusion
• ADT acts as a useful guideline to implement a data type correctly.
• The implementation of an ADT involves the translation of the ADT’s
specification into syntax of a particular programming language.
• For ex, the int data type, provides an implementation of the
mathematical concept of an integer number.
• The int data type in C can be considered as an implementation of
Abstract Data Type, INTEGER-ADT, which defines the union of set { -1, -
2, -3 …} and the set of whole numbers {0, 1, ....}
Ashim Lamichhane 20
The Array As An ADT
• An array is probably the most versatile or fundamental Abstract Data
Type
• An array is a finite sequence of storage cells, for which the following
operations are defined:
• create(A,N)creates an array A with storage for N items;
• A[i]=item stores item in the ith position in the array A; and
• A[i] returns the value of the item stored in the ith position in the array A.
Ashim Lamichhane 21
Show that an array is an ADT
• Let A be an array of type T and has n elements then it satisfied the following
operations
1. CREATE(A): Create an array A
2. INSERT(A,X): Insert an element X into an array A in any location
3. DELETE(A,X): Delete an element X from an array A
4. MODIFY(A,X,Y): modify element X by Y of an array A
5. TRAVELS(A): Access all elements of an array A
6. MERGE(A,B): Merging elements of A and B into a third array C
Thus by using 1D array we can perform above operations thus an array acts
as an ADT.
Ashim Lamichhane 22
Conclusion
• An abstract data type is the specification of the data type which
specifies the logical and mathematical model of the data type.
• A data type is the implementation of an abstract data type.
• Data Structure refers to the collection of computer variables that are
connected in specific manner.
Ashim Lamichhane 23
ASSIGNMENT AT FOLLOWING LINK
https://github.com/ashim888/dataStructureAndAlgorithm/tree/master/
Assignments/assignment_3
Ashim Lamichhane 24

More Related Content

PPT
Unix memory management
PPT
Priority queues
PPT
Firewalls
PPTX
Memory Organization
PDF
Advanced heap exploitaion
PDF
Design of Secure Hash Algorithm(SHA)
PPSX
Data structure stack&queue basics
PPT
Heap sort
Unix memory management
Priority queues
Firewalls
Memory Organization
Advanced heap exploitaion
Design of Secure Hash Algorithm(SHA)
Data structure stack&queue basics
Heap sort

What's hot (20)

PPTX
queue.pptx
PDF
Computer organization memory
PPT
Memory Management in OS
PDF
Data Structure Basics
PDF
Linux Binary Exploitation - Return-oritend Programing
PPTX
Assembly language (addition and subtraction)
PPTX
Cache performance considerations
PPT
CONVENTIONAL ENCRYPTION
PDF
Difference between molap, rolap and holap in ssas
PPTX
kali linux
PPTX
Idea alogorithim
PPT
Abstract data types
PPTX
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
PPT
Deadlock
PPTX
Unit 1 array based implementation
PPT
Queue data structure
PPTX
Stack operation algorithms with example
PDF
Embedded Systems (18EC62) – Embedded System Design Concepts (Module 4)
PPTX
Lecture 37
PPTX
( Ethical hacking tools ) Information grathring
queue.pptx
Computer organization memory
Memory Management in OS
Data Structure Basics
Linux Binary Exploitation - Return-oritend Programing
Assembly language (addition and subtraction)
Cache performance considerations
CONVENTIONAL ENCRYPTION
Difference between molap, rolap and holap in ssas
kali linux
Idea alogorithim
Abstract data types
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Deadlock
Unit 1 array based implementation
Queue data structure
Stack operation algorithms with example
Embedded Systems (18EC62) – Embedded System Design Concepts (Module 4)
Lecture 37
( Ethical hacking tools ) Information grathring
Ad

Viewers also liked (20)

PPTX
Searching
PPTX
PPTX
Algorithm big o
PPTX
Unit 11. Graphics
PPTX
Unit 9. Structure and Unions
PPTX
Algorithm Introduction
PPTX
Linked List
PPTX
PPTX
The Stack And Recursion
PPTX
Unit 8. Pointers
PPTX
Unit 6. Arrays
PPTX
Friedman two way analysis of variance by
PPTX
Unit 7. Functions
PDF
Formal Concept Analysis
PPT
Data analysis chapter 18 from the companion website for educational research
PPTX
UNIT 10. Files and file handling in C
PPTX
File handling in c
PPTX
Concept Analysis Presentation
PPTX
Tree - Data Structure
PPTX
Text data mining1
Searching
Algorithm big o
Unit 11. Graphics
Unit 9. Structure and Unions
Algorithm Introduction
Linked List
The Stack And Recursion
Unit 8. Pointers
Unit 6. Arrays
Friedman two way analysis of variance by
Unit 7. Functions
Formal Concept Analysis
Data analysis chapter 18 from the companion website for educational research
UNIT 10. Files and file handling in C
File handling in c
Concept Analysis Presentation
Tree - Data Structure
Text data mining1
Ad

Similar to Introduction to data_structure (20)

PPTX
Data Structures - Lecture 1 - Unit 1.pptx
PPTX
Introduction to DS.pptx
PPT
Data structure
PPTX
II B.Sc IT DATA STRUCTURES.pptx
PDF
Chapter 1 Introduction to Data Structures and Algorithms.pdf
PPT
Chapter 1 - Introduction to Data Structure.ppt
PPTX
CHAPTER-1- Introduction to data structure.pptx
PDF
Unit 1 OF DS FOR AI DS BTRCH OF DS FOR AI DS BTRCH .pdf
PPTX
Chapter 1 _edited.pptx.software engineering
PPTX
Abstract Data Types (ADTs) in Data Structures
PPTX
Abstract Data Types (ADTs) in Data Structures
PPTX
Abstract Data Types (ADTs) in Data Structures
PPTX
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_II_08-08-2022_D...
PPTX
UNIT 1.pptx
PDF
U nit i data structure-converted
DOCX
Data structure and algorithm.
PPTX
UNIT 1 Memory ManagementMemory Management.pptx
PPTX
Unit4pptx__2024_11_ 11_10_16_09.pptx
PPTX
b,Sc it data structure.pptx
Data Structures - Lecture 1 - Unit 1.pptx
Introduction to DS.pptx
Data structure
II B.Sc IT DATA STRUCTURES.pptx
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 - Introduction to Data Structure.ppt
CHAPTER-1- Introduction to data structure.pptx
Unit 1 OF DS FOR AI DS BTRCH OF DS FOR AI DS BTRCH .pdf
Chapter 1 _edited.pptx.software engineering
Abstract Data Types (ADTs) in Data Structures
Abstract Data Types (ADTs) in Data Structures
Abstract Data Types (ADTs) in Data Structures
FALLSEM2022-23_BCSE202L_TH_VL2022230103292_Reference_Material_II_08-08-2022_D...
UNIT 1.pptx
U nit i data structure-converted
Data structure and algorithm.
UNIT 1 Memory ManagementMemory Management.pptx
Unit4pptx__2024_11_ 11_10_16_09.pptx
b,Sc it data structure.pptx

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
KodekX | Application Modernization Development
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Spectroscopy.pptx food analysis technology
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Electronic commerce courselecture one. Pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Reach Out and Touch Someone: Haptics and Empathic Computing
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Dropbox Q2 2025 Financial Results & Investor Presentation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Understanding_Digital_Forensics_Presentation.pptx
KodekX | Application Modernization Development
Digital-Transformation-Roadmap-for-Companies.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Building Integrated photovoltaic BIPV_UPV.pdf
Review of recent advances in non-invasive hemoglobin estimation
MIND Revenue Release Quarter 2 2025 Press Release
20250228 LYD VKU AI Blended-Learning.pptx
sap open course for s4hana steps from ECC to s4
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Spectroscopy.pptx food analysis technology
Chapter 3 Spatial Domain Image Processing.pdf

Introduction to data_structure

  • 1. Unit 1 Concept and Definition of Data Structures Ashim Lamichhane 1
  • 2. Goal • As computers become faster and faster, the need for programs that can handle large amounts of input becomes more acute. • This requires more careful attention to efficiency, since inefficiencies in programs become most obvious when input sizes are large. • By analyzing an algorithm before it is actually coded, we can decide if a particular solution will be feasible. • The goal is to develop good programming and algorithm analysis skills simultaneously so that we can develop such programs with the maximum amount of efficiency. Ashim Lamichhane 2
  • 3. Objective • To identify and create useful mathematical entities to determine what classes of problems can be solved by using these entities and operations. • To determine the representations of these abstract entities and to implement the abstract operations on these concrete representations. Ashim Lamichhane 3
  • 4. Introduction to the theory of DATA STRUCTURE • It’s a branch of computer science that unleashes the knowledge of • how data should organized, • how the flow of data should be controlled and • how data structure should be designed and implemented to reduce the complexity and increase the efficiency of the algorithm. • It enables you to design and implement various data structure, for example, the stacks, queues, linked lists, trees and graphs. • Effective use of principles of data structures increases efficiency of algorithms to solve problems like searching, sorting, populating and handling huge set of data. Ashim Lamichhane 4
  • 5. Need of a Data Structure • A data structure helps you to understand the relationship of one data element with the other and organize it within the memory. • Consider an example, list of names of months in a year. • Similarly consider a set of data that represents location of historical places in a country. • Such data form a hierarchical relationship between them and must be represented in the memory using a hierarchical type of data structure Ashim Lamichhane 5
  • 6. Nepal ktm bkt LLt pashupati baglamukhi suryabinayak Mahabauddha temple Krishna mandir Fig. hierarchical representation Ashim Lamichhane 6
  • 7. Data structures are widely applied in areas like • Compiler design • Operating system • Statistical analysis package • DBMS • Numerical analysis • Simulation • Artificial Intelligence • Graphics Ashim Lamichhane 7
  • 8. Arrays • One dimensional array can be represented either as a single column or as single row. • Following are some valid array declarations: • Int age[15]; • Float weight[40]; • Following are some invalid array declarations in c: • Int value[0]; • Int marks[0.5]; • Int number[-5]; Ashim Lamichhane 8
  • 9. Some common operation performed in 1D array • Creating an array • Inserting new element at required position • Deletion of any array element • Modification of any element • Traversing of an array • Merging of arrays Ashim Lamichhane 9
  • 10. CODE SAMPLE CHECK • FOLLOW THE LINK https://github.com/ashim888/dataStructureAndAlgorithm/blob/master/ codes/shift_pos.c Ashim Lamichhane 10
  • 11. ASSIGNMENT AT FOLLOWING LINK https://github.com/ashim888/dataStructureAndAlgorithm/tree/master/ Assignments/assignment_3 Ashim Lamichhane 11
  • 12. Implementation of a two dimensional array • A two dimensional array can be implemented in a programming language in two ways: • Row Major Implementation • Column Major Implementation Ashim Lamichhane 12
  • 13. Row Major Implementation • Row-major implementation is a linearization technique in which elements of array are readers from the keyboard row-wise • The complete first row is stored and then the complete second row is stored. • For example, an array a[3][3] is stored in the memory as shown in fig below: Ashim Lamichhane 13
  • 14. Column Major Implementation • In column major implementation memory allocation is done column by column i.e. at first the elements of the complete first column is stored, and then elements of complete second column is stored, and so on. • For example an array a [3] [3] is stored in the memory as shown in the fig below: Ashim Lamichhane 14
  • 15. Multi-Dimensional array • C also allows arrays with more than two dimensions. For example, a three dimensional array may be declared by int a[3][2][4] • Here, the first subscript specifies a plane number, the second subscript a row number and the third a column number. Ashim Lamichhane 15
  • 16. Multi-Dimensional array Fig. Representation of array a[3][2][4] Ashim Lamichhane 16
  • 18. Abstract Data Types (ADT) • We are well acquainted with data types by now, like integers, arrays, and so on. • To access the data, we've used operations defined in the programming language for the data type, for instance by accessing array elements by using the square bracket notation. • An abstract data type is a data type whose representation is hidden from, and of no concern to the application code. Ashim Lamichhane 18
  • 19. Abstract Data Types (ADT) • For example, when writing application code, we don’t care how strings are represented: we just declare variables of type string, and manipulate them by using string operations. • Once an abstract data type has been designed, the programmer responsible for implementing that type is concerned only with choosing a suitable data structure and coding up the methods. • On the other hand, application programmers are concerned only with using that type and calling its methods without worrying much about how the type is implemented. Ashim Lamichhane 19
  • 20. ADT conclusion • ADT acts as a useful guideline to implement a data type correctly. • The implementation of an ADT involves the translation of the ADT’s specification into syntax of a particular programming language. • For ex, the int data type, provides an implementation of the mathematical concept of an integer number. • The int data type in C can be considered as an implementation of Abstract Data Type, INTEGER-ADT, which defines the union of set { -1, - 2, -3 …} and the set of whole numbers {0, 1, ....} Ashim Lamichhane 20
  • 21. The Array As An ADT • An array is probably the most versatile or fundamental Abstract Data Type • An array is a finite sequence of storage cells, for which the following operations are defined: • create(A,N)creates an array A with storage for N items; • A[i]=item stores item in the ith position in the array A; and • A[i] returns the value of the item stored in the ith position in the array A. Ashim Lamichhane 21
  • 22. Show that an array is an ADT • Let A be an array of type T and has n elements then it satisfied the following operations 1. CREATE(A): Create an array A 2. INSERT(A,X): Insert an element X into an array A in any location 3. DELETE(A,X): Delete an element X from an array A 4. MODIFY(A,X,Y): modify element X by Y of an array A 5. TRAVELS(A): Access all elements of an array A 6. MERGE(A,B): Merging elements of A and B into a third array C Thus by using 1D array we can perform above operations thus an array acts as an ADT. Ashim Lamichhane 22
  • 23. Conclusion • An abstract data type is the specification of the data type which specifies the logical and mathematical model of the data type. • A data type is the implementation of an abstract data type. • Data Structure refers to the collection of computer variables that are connected in specific manner. Ashim Lamichhane 23
  • 24. ASSIGNMENT AT FOLLOWING LINK https://github.com/ashim888/dataStructureAndAlgorithm/tree/master/ Assignments/assignment_3 Ashim Lamichhane 24