SlideShare a Scribd company logo
Lecture No.01
Data Structures
Rubya Afrin
Lecturer
Northern University of Business and Technology
Data Structures
 Prepares the students for (and is a prerequisite for) the more
advanced material students will encounter in later courses.
 Cover well-known data structures such as dynamic arrays, linked
lists, stacks, queues, tree and graphs.
 Implement data structures in C++
Grading
 Attendance 5
 Class test, Assignment, Presentation 25
 Mid Term 30
 Final Exam 30
Total 100
Data Structure
 A data structure is a particular way of organizing
data in a computer so that it can be used
efficiently.
4
Need for Data Structures
 Data structures organize data ⇒ more efficient programs.
 More powerful computers ⇒ more complex applications.
 More complex applications demand more calculations.
Examples
 Array
 Linked List
 Stack
 Queue
 Tree
 Graph
 Hash
6
Array
 In computer science, an array data structure, or
simply an array, is a data structure consisting of a
collection of elements (values or variables), each
identified by at least one array index or key.
 The simplest type of data structure is a linear
array, also called one-dimensional array.
7
Arrays
 Array declaration: int x[6];
 An array is collection of cells of the same type.
 The collection has the name ‘x’.
 The cells are numbered with consecutive
integers.
 To access a cell, use the array name and an
index:
x[0], x[1], x[2], x[3], x[4], x[5]
Arrays
 Elementary data structure that exists as built-in
in most programming languages.
int main()
{
int x[6];
int j;
for(i=0; i< 6; i++)
x[j] = 2*i;
}
Array Layout
x[1]
x[2]
x[3]
x[4]
x[5]
x[0]
Array cells are
contiguous in
computer memory
The memory can be
thought of as an
array
What is Array Name?
 ‘x’ is an array name but there is no variable x. ‘x’ is not an value.
 For example, if we have the code
int a, b;
then we can write
b = 2;
a = b;
a = 5;
But we cannot write
2 = a;
Array Name
 ‘x’ is not an value
int x[6];
int n;
x[0] = 5;
x[1] = 2;
x = 3; // not allowed
x = a + b; // not allowed
x = &n; // not allowed
The LIST Data Structure
 The List is among the most generic of data
structures.
 Real life:
a. shopping list,
b. groceries list,
c. list of people to invite to dinner
d. List of presents to get
Lists
 A list is collection of items that are all of the
same type (grocery items, integers, names)
 The items, or elements of the list, are stored in
some particular order
 It is possible to insert new elements into various
positions in the list and remove any element of
the list
Lists
 List is a set of elements in a linear order.
For example, data values a1, a2, a3, a4 can be
arranged in a list:
(a3, a1, a2, a4)
In this list, a3, is the first element, a1 is the
second element, and so on
 The order is important here; this is not just a
random collection of elements, it is an ordered
collection
List Operations
Useful operations
 createList(): create a new list (presumably empty)
 copy(): set one list to be a copy of another
 clear(); clear a list (remove all elments)
 insert(X, ?): Insert element X at a particular position
in the list
 remove(?): Remove element at some position in
the list
 get(?): Get element at a given position
 update(X, ?): replace the element at a given position
with X
 find(X): determine if the element X is in the list
 length(): return the length of the list.
List Operations
 If we use the “current” marker, the following
four methods would be useful:
 start(): moves to “current” pointer to the very first
element.
 tail(): moves to “current” pointer to the very last
element.
 next(): move the current position forward one
element
 back(): move the current position backward one
element

More Related Content

PPTX
Data structure and its types
Navtar Sidhu Brar
 
PPTX
Data structure power point presentation
Anil Kumar Prajapati
 
PPT
Lecture 2a arrays
Victor Palmar
 
PPTX
DATA STRUCTURE
Rohit Rai
 
PPT
Arrays Basics
Nikhil Pandit
 
PPTX
Data structures
Lovely Professional University
 
PPT
Data structure
viswanathV8
 
PPTX
Array in c programming
Manojkumar C
 
Data structure and its types
Navtar Sidhu Brar
 
Data structure power point presentation
Anil Kumar Prajapati
 
Lecture 2a arrays
Victor Palmar
 
DATA STRUCTURE
Rohit Rai
 
Arrays Basics
Nikhil Pandit
 
Data structure
viswanathV8
 
Array in c programming
Manojkumar C
 

What's hot (20)

PDF
2nd puc computer science chapter 3 data structures 1
Aahwini Esware gowda
 
PPTX
arrays of structures
arushi bhatnagar
 
PPTX
Introduction of Data Structure
Mandavi Classes
 
PPTX
ARRAY
ayush raj
 
PPTX
Data structures
Pranav Gupta
 
PPTX
Introduction to data structure
Vivek Kumar Sinha
 
PDF
Data structure ppt
Prof. Dr. K. Adisesha
 
PPTX
Presentation on array
topu93
 
PPT
Introduction to data structure by anil dutt
Anil Dutt
 
PDF
9 python data structure-2
Prof. Dr. K. Adisesha
 
PPTX
Array
Rahul Sharma
 
PPTX
Introduction To Data Structures.
Education Front
 
PPTX
Data Structures
Rahul Jamwal
 
PPTX
Data Structures (CS8391)
Elavarasi K
 
PPTX
A Presentation About Array Manipulation(Insertion & Deletion in an array)
Imdadul Himu
 
PPTX
Array in c programming
2569294Mohan
 
PPTX
Bca ii dfs u-1 introduction to data structure
Rai University
 
PPT
Abstract data types
Poojith Chowdhary
 
PDF
Data Structures (BE)
PRABHAHARAN429
 
PPTX
Array in C
Kamal Acharya
 
2nd puc computer science chapter 3 data structures 1
Aahwini Esware gowda
 
arrays of structures
arushi bhatnagar
 
Introduction of Data Structure
Mandavi Classes
 
ARRAY
ayush raj
 
Data structures
Pranav Gupta
 
Introduction to data structure
Vivek Kumar Sinha
 
Data structure ppt
Prof. Dr. K. Adisesha
 
Presentation on array
topu93
 
Introduction to data structure by anil dutt
Anil Dutt
 
9 python data structure-2
Prof. Dr. K. Adisesha
 
Introduction To Data Structures.
Education Front
 
Data Structures
Rahul Jamwal
 
Data Structures (CS8391)
Elavarasi K
 
A Presentation About Array Manipulation(Insertion & Deletion in an array)
Imdadul Himu
 
Array in c programming
2569294Mohan
 
Bca ii dfs u-1 introduction to data structure
Rai University
 
Abstract data types
Poojith Chowdhary
 
Data Structures (BE)
PRABHAHARAN429
 
Array in C
Kamal Acharya
 
Ad

Similar to Data structures (20)

PPTX
ds bridge.pptx
GOOGLEINTERNETCAFE1
 
PPT
Unit 1.ppt
Minakshee Patil
 
PPT
CS301-lec01.ppt
omair31
 
PDF
DS Complete notes for Computer science and Engineering
RAJASEKHARV8
 
PPTX
DS Module1 (1).pptx
AnuJoseph95
 
PPT
Data Structure Lec #1
University of Gujrat, Pakistan
 
PPTX
DATA STRUCTURE AND ALGORITHM with linked list
shanmugapriyacsecs
 
PPTX
introduction of Data strutter and algirithm.pptx
ssuser7b3003
 
PPTX
Data Structure and Algorithms by Sabeen Memon03.pptx
msoomar8611
 
PPTX
Introduction to Data Structures and their importance
Bulbul Agrawal
 
PPT
Data structure lecture 1
Kumar
 
PPTX
Introduction to Data Structure
chouguleamruta24
 
PPTX
introduction_dst.pptx
HammadTariq51
 
PPTX
Data structures - unit 1
SaranyaP45
 
PPT
Data structure and algorithm with java by shikra
jateno3396
 
PDF
2. Introduction to Data Structure.pdf
SulabhPawaia
 
PPTX
Data Structure Introduction- Arrays, Matrix, Linked List
JasmineJinitha
 
PPTX
8.DATA STRUCTURES UNIT 1 AND 2 CS3301PPT.pptx
venigkrish89
 
PPT
Data structures cs301 power point slides lecture 01
shaziabibi5
 
PPTX
DS_PPT.pptx
MeghaKulkarni27
 
ds bridge.pptx
GOOGLEINTERNETCAFE1
 
Unit 1.ppt
Minakshee Patil
 
CS301-lec01.ppt
omair31
 
DS Complete notes for Computer science and Engineering
RAJASEKHARV8
 
DS Module1 (1).pptx
AnuJoseph95
 
Data Structure Lec #1
University of Gujrat, Pakistan
 
DATA STRUCTURE AND ALGORITHM with linked list
shanmugapriyacsecs
 
introduction of Data strutter and algirithm.pptx
ssuser7b3003
 
Data Structure and Algorithms by Sabeen Memon03.pptx
msoomar8611
 
Introduction to Data Structures and their importance
Bulbul Agrawal
 
Data structure lecture 1
Kumar
 
Introduction to Data Structure
chouguleamruta24
 
introduction_dst.pptx
HammadTariq51
 
Data structures - unit 1
SaranyaP45
 
Data structure and algorithm with java by shikra
jateno3396
 
2. Introduction to Data Structure.pdf
SulabhPawaia
 
Data Structure Introduction- Arrays, Matrix, Linked List
JasmineJinitha
 
8.DATA STRUCTURES UNIT 1 AND 2 CS3301PPT.pptx
venigkrish89
 
Data structures cs301 power point slides lecture 01
shaziabibi5
 
DS_PPT.pptx
MeghaKulkarni27
 
Ad

More from Rokonuzzaman Rony (20)

PPTX
Course outline for c programming
Rokonuzzaman Rony
 
PPTX
Pointer
Rokonuzzaman Rony
 
PPTX
Operator Overloading & Type Conversions
Rokonuzzaman Rony
 
PPTX
Constructors & Destructors
Rokonuzzaman Rony
 
PPTX
Classes and objects in c++
Rokonuzzaman Rony
 
PPTX
Functions in c++
Rokonuzzaman Rony
 
PPTX
Object Oriented Programming with C++
Rokonuzzaman Rony
 
PPTX
Humanitarian task and its importance
Rokonuzzaman Rony
 
PPTX
Structure
Rokonuzzaman Rony
 
PPTX
Pointers
Rokonuzzaman Rony
 
PPTX
Introduction to C programming
Rokonuzzaman Rony
 
PPTX
Constants, Variables, and Data Types
Rokonuzzaman Rony
 
PPTX
C Programming language
Rokonuzzaman Rony
 
PPTX
User defined functions
Rokonuzzaman Rony
 
PPTX
Numerical Method 2
Rokonuzzaman Rony
 
PPT
Numerical Method
Rokonuzzaman Rony
 
PPTX
Data structures
Rokonuzzaman Rony
 
PPTX
Data structures
Rokonuzzaman Rony
 
Course outline for c programming
Rokonuzzaman Rony
 
Operator Overloading & Type Conversions
Rokonuzzaman Rony
 
Constructors & Destructors
Rokonuzzaman Rony
 
Classes and objects in c++
Rokonuzzaman Rony
 
Functions in c++
Rokonuzzaman Rony
 
Object Oriented Programming with C++
Rokonuzzaman Rony
 
Humanitarian task and its importance
Rokonuzzaman Rony
 
Introduction to C programming
Rokonuzzaman Rony
 
Constants, Variables, and Data Types
Rokonuzzaman Rony
 
C Programming language
Rokonuzzaman Rony
 
User defined functions
Rokonuzzaman Rony
 
Numerical Method 2
Rokonuzzaman Rony
 
Numerical Method
Rokonuzzaman Rony
 
Data structures
Rokonuzzaman Rony
 
Data structures
Rokonuzzaman Rony
 

Recently uploaded (20)

PPTX
Virus sequence retrieval from NCBI database
yamunaK13
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PDF
Virat Kohli- the Pride of Indian cricket
kushpar147
 
PPTX
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
PPTX
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
PPTX
Basics and rules of probability with real-life uses
ravatkaran694
 
PPTX
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PPTX
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
PPTX
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PPTX
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
PPTX
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
DOCX
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Virus sequence retrieval from NCBI database
yamunaK13
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
Virat Kohli- the Pride of Indian cricket
kushpar147
 
Kanban Cards _ Mass Action in Odoo 18.2 - Odoo Slides
Celine George
 
A Smarter Way to Think About Choosing a College
Cyndy McDonald
 
Basics and rules of probability with real-life uses
ravatkaran694
 
How to Track Skills & Contracts Using Odoo 18 Employee
Celine George
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
CDH. pptx
AneetaSharma15
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
Applications of matrices In Real Life_20250724_091307_0000.pptx
gehlotkrish03
 
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
Nguyen Thanh Tu Collection
 
Continental Accounting in Odoo 18 - Odoo Slides
Celine George
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
BASICS IN COMPUTER APPLICATIONS - UNIT I
suganthim28
 
20250924 Navigating the Future: How to tell the difference between an emergen...
McGuinness Institute
 
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 

Data structures

  • 1. Lecture No.01 Data Structures Rubya Afrin Lecturer Northern University of Business and Technology
  • 2. Data Structures  Prepares the students for (and is a prerequisite for) the more advanced material students will encounter in later courses.  Cover well-known data structures such as dynamic arrays, linked lists, stacks, queues, tree and graphs.  Implement data structures in C++
  • 3. Grading  Attendance 5  Class test, Assignment, Presentation 25  Mid Term 30  Final Exam 30 Total 100
  • 4. Data Structure  A data structure is a particular way of organizing data in a computer so that it can be used efficiently. 4
  • 5. Need for Data Structures  Data structures organize data ⇒ more efficient programs.  More powerful computers ⇒ more complex applications.  More complex applications demand more calculations.
  • 6. Examples  Array  Linked List  Stack  Queue  Tree  Graph  Hash 6
  • 7. Array  In computer science, an array data structure, or simply an array, is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key.  The simplest type of data structure is a linear array, also called one-dimensional array. 7
  • 8. Arrays  Array declaration: int x[6];  An array is collection of cells of the same type.  The collection has the name ‘x’.  The cells are numbered with consecutive integers.  To access a cell, use the array name and an index: x[0], x[1], x[2], x[3], x[4], x[5]
  • 9. Arrays  Elementary data structure that exists as built-in in most programming languages. int main() { int x[6]; int j; for(i=0; i< 6; i++) x[j] = 2*i; }
  • 10. Array Layout x[1] x[2] x[3] x[4] x[5] x[0] Array cells are contiguous in computer memory The memory can be thought of as an array
  • 11. What is Array Name?  ‘x’ is an array name but there is no variable x. ‘x’ is not an value.  For example, if we have the code int a, b; then we can write b = 2; a = b; a = 5; But we cannot write 2 = a;
  • 12. Array Name  ‘x’ is not an value int x[6]; int n; x[0] = 5; x[1] = 2; x = 3; // not allowed x = a + b; // not allowed x = &n; // not allowed
  • 13. The LIST Data Structure  The List is among the most generic of data structures.  Real life: a. shopping list, b. groceries list, c. list of people to invite to dinner d. List of presents to get
  • 14. Lists  A list is collection of items that are all of the same type (grocery items, integers, names)  The items, or elements of the list, are stored in some particular order  It is possible to insert new elements into various positions in the list and remove any element of the list
  • 15. Lists  List is a set of elements in a linear order. For example, data values a1, a2, a3, a4 can be arranged in a list: (a3, a1, a2, a4) In this list, a3, is the first element, a1 is the second element, and so on  The order is important here; this is not just a random collection of elements, it is an ordered collection
  • 16. List Operations Useful operations  createList(): create a new list (presumably empty)  copy(): set one list to be a copy of another  clear(); clear a list (remove all elments)  insert(X, ?): Insert element X at a particular position in the list  remove(?): Remove element at some position in the list  get(?): Get element at a given position  update(X, ?): replace the element at a given position with X  find(X): determine if the element X is in the list  length(): return the length of the list.
  • 17. List Operations  If we use the “current” marker, the following four methods would be useful:  start(): moves to “current” pointer to the very first element.  tail(): moves to “current” pointer to the very last element.  next(): move the current position forward one element  back(): move the current position backward one element