Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
55 views

CSE 134: Data Structure Lecture #1: Mohammad Reduanul Haque

This document provides an introduction to the CSE 134: Data Structure course. It discusses the instructor, textbook, and course code details. It then defines data, data structures, and common data structure operations like traversing, searching, inserting and deleting. Finally, it discusses algorithms and their complexity in terms of time and space. The goal of the course is to learn clever ways to organize data to enable efficient computation using common data structures and algorithms.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

CSE 134: Data Structure Lecture #1: Mohammad Reduanul Haque

This document provides an introduction to the CSE 134: Data Structure course. It discusses the instructor, textbook, and course code details. It then defines data, data structures, and common data structure operations like traversing, searching, inserting and deleting. Finally, it discusses algorithms and their complexity in terms of time and space. The goal of the course is to learn clever ways to organize data to enable efficient computation using common data structures and algorithms.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

CSE 134: Data Structure

Lecture #1
Introduction

Mohammad Reduanul Haque


Lecturer, Dept. of CSE
Course Information
Instructor: Md. Reduanul Haque
Sr. Lecturer, CSE
Daffodil International University
Email: reduan.cse@diu.edu.bd

Office hours: Tuesday, 10:30-11:30 am

Google Classroom Code: ya5bdbn


BLC Link: https://elearn.daffodilvarsity.edu.bd/course/view.php?id=5733

Text Book:

1. Data Structures & Algorithm Analysis in C++, 2nd edition, by Mark Allen
Weiss
2. P.S. Deshpande and O.G. Kakde, C and Data Structures, Charles Rive
Media, 2004
Data
Data are information in raw or unorganized form (such as alphabets, numbers,
or symbols) that refer to, or represent, conditions, ideas, or objects. Data are
values or set of values. A data item refers to a single unit of values.
Data items that are divided into sub items are group items; those that are not
are called elementary items.
For example, a student’s name may be divided into three sub items – [first
name, middle name and last name] but the ID of a student would normally be
treated as a single item.
In the above example ( ID, Age, Gender, First, Middle, Last, Street, Area ) are
elementary data items, whereas (Name, Address ) are group data items.

An entity is something that has certain attributes or properties which may be


assigned values. The values themselves may be either numeric or non-numeric.

Example:
Attributes: Name Age Gender Social Society number
Values: Hamza 20 M 134-24-5533
Ali 23 M 234-9988775

Entities with similar attributes (e.g. all the employees in an organization)


form an entity set. Each attribute of an entity set has a range of values, the set of all
possible values that could be assigned to the particular attribute.

The term “information” is sometimes used for data with given attributes of in other words
meaningful or processed data.
Data Structure
In computer science, a data structure is a particular way of storing and
organizing data in a computer’s memory so that it can be used
efficiently.

Data may be stored/organized in many different ways.

The logical or mathematical model of a particular organization of data


is called a data structure.
The choice of a particular data model depends on the two
considerations first; it must be rich enough in structure to mirror the
actual relationships of the data in the real world.

On the other hand, the structure should be simple enough that one can
effectively process the data whenever necessary.
What is this Course About?

Clever ways to organize data in order to enable


efficient computation

– What do we mean by clever?

– What do we mean by efficient?


Clever? Efficient?

Array, Lists Insert


Stacks, Queues Delete
Heap Tree Find/Search
Binary Search Trees Merge
AVL Trees Update
Graphs Sort

Data Structures Algorithms


Array
Linear array (One dimensional array) : A list of finite number n of similar data
elements referenced respectively by a set of n consecutive numbers, usually 1,
2, 3,…..n. That is a specific element is accessed by an index.
Let, Array name is A then the elements of A is : a1,a2….. an
Or by the bracket notation A[1], A[2], A[3],…………., A[n]
The number k in A[k] is called a subscript and A[k] is called a subscripted
variable.

element
Example
A linear array STUDENT consisting of the name of six students

STUDENT
1 Dalia Rahaman
2 Sumona
3 Mubtasim Fuad
4
Anamul Haque
5
6 Ibtisam Rahaman
Jarin

Here, STUDENT[4] denote Anamul Haque


Array (con…)
Linear arrays are called one dimensional arrays because each
element in such an array is referenced by one subscript.
(Two dimensional array) : Two dimensional array is a collection of
similar data elements where each element is referenced by two
subscripts.
Such arrays are called matrices in mathematics and tables in
business applications.
Multidimensional arrays are defined analogously

MATRICES
1 2 3 4
1 1 2 3 4
Here, MATRICES[3,3]=11
2 5 6 7 8
3 9 10 11 12
4 13 14 15 16
Array Data Structure

It can hold multiple values of a single type.


Elements are referenced by the array name and an ordinal index.
Each element is a value
Indexing begins at zero.
The array forms a contiguous list in memory.
The name of the array holds the address of the first array element.
We specify the array size at compile time, often with a named constant.
Linked lists
A linked list, or one way list, is a linear collection of data elements,
called nodes, where the linear order is given by means of pointers.

Dynamically allocate space for each element as needed.

Node

Data Next

In linked list
Each node of the list contains the data item a pointer to the
next node

Collection structure has a pointer to the list Start


Initially NULL
Start
Linked lists

Start

node
node
Data Next Data

Linked list with 2 nodes


Linked lists
INFO LINK

START 1 START=3, INFO[3]=M

3 2 A 5 LINK[3]=2, INFO[2]=A

2 LINK[2]=5, INFO[5]=N
3 M
LINK[5]=4, INFO[4]=G
4 G 7
LINK[4]=7, INFO[7]=O
5 N 4 LINK[7]=0, NULL value, So the list has ended

6
7 O 0

8
Stacks
• Stacks are a special form of collection
with LIFO semantics
• Two methods
- add item to the top of the stack
- remove an item from the top of the stack
• Like a plate stacker
Queues

• Like a stack, a queue is also a list. However,


with a queue, insertion is done at one end, while
deletion is performed at the other end
• The insertion end is called rear
– The deletion end is called front

Remove Insert
front rear
edges
Data structure operations
The data appearing in our data structure is processed by means of certain
operations. In fact, the particular data structure that one chooses for a
given situation depends largely on the frequency with which specific
operations are performed. The following four operations play a major role:

Traversing
Accessing each record exactly once so that certain items in the record
may be processed. (This accessing or processing is sometimes called
'visiting" the records.)

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.

Inserting
Adding new records to the structure.

Deleting
Removing a record from the structure.
Data structure operations (Continued)

The following two operations, which are used in special situations, will also be
considered:
Sorting:
Arranging the records in some logical order
Merging:
Combining the records in two different sorted files into a single sorted files
Algorithms
An essential aspect to data structures is algorithms. Data structures
are implemented using algorithms.
An Algorithm is a finite step – by – step list of well defined instructions
for solving a particular problem. It is used to manipulate the data
contained in the data structures as in searching and sorting. It states
explicitly how the data will be manipulated.

Perform data structure operations


Complexity

The complexity of an algorithm is a function describing the efficiency of the


algorithm in terms of the amount of data the algorithm must process. There
are two main complexity measures of the efficiency of an algorithm:

Time complexity is a function describing the amount of time an algorithm


takes in terms of the amount of input to the algorithm.

Space complexity is a function describing the amount of memory (space) an


algorithm takes in terms of the amount of input to the algorithm.

You might also like