You are on page 1of 18

Faculty Of Engineering and Technology

Department of Computer Science


Course: Data structure and Algorithm
(Lecture-1)

Sayed Mortaza Kazemi


Department of Computer Science
Email: sayedmortaza11@gmail.com
Mobile: +93(0) 795474969
Data
• The collection of facts and figure is called data (general)
• Data is the raw form of information
• In computing, data is information that has been translated
into a form that is more convenient to move or process.
Relative to today's computers and transmission media, data is
information converted into binary digital form.

2
Data types
• To understand data we consider its types
• Data can be character, like grade ‘A’ B’, etc
• Data can be string, like name ‘Akram’, Sajjad’
• Data can be real number, like temperature 34.5, -9.0
• Data can be integer number, like Student ID 10, 16
• Data can be Alphanumeric like House number ’34/A’

3
Data types
• Data can be in Boolean form like TRUE / FALSE

Whether we go there? NO / FALSE


• Data can be in the form of sound, like the sound you play in computer
• Data can be in form of graphics, like your picture in computer
• Data can be in the form of animated graphics, like movies in computer

4
Data - classes

• Group Data Item


– A Data item that can be further divided into sub
items
• Name: if it has first name, last name, etc
• Address: House No. Street No. City name,
country name, etc
• Simple Data Item
– A Data item that is not further divided into other
sub data items
• Blood Group, A+, O-
• Student Id, 123, 490

5
structure
• Ways of representation of something

• Relation between collection of facts or raw material is called


structure

6
Data Structure
• A data structure is a way to store and organize data in order to facilitate
access and modifications
• Computer keeps data in organized form for processing
• This organized form of data is called data structure
• Data structure should have be simple and mirror the actual
relationship of the data in the real world
– No single data structure works well for all purposes, and so it is important to know
the strengths and limitations of several of them

7
Types of data structure
• Linear data structure
• The organization of data in a single row or in a single column is
called linear data structure
• Example data structure in memory as Arrays ,stacks ,queues and
Link Lists
• Non linear data structure
• The organization of data in HIRARICHAL form is called non linear
data structure
• Example trees ,Graphs ,Files

8
Basic Data Structures

Linear Data Structures Non-Linear Data Structures

Arrays Linked Lists Stacks Queues Trees Graphs

9
exp DATA STRUCTURE OPERATIONS
• An organization contains a membership file in which each record contains
the following data for a given member:
– Name
– Address
– Telephone number
– Age
– Gender
• Announce meeting through a mailing
– Traverse the file to obtain name and address of each member
• Find the names of all members living in a certain area
– Again traverse to obtain the required data
• Obtain address for a given name
– Search the file for the record containing the name

10
Example (continue)
• New person joins the organization
– Insert his/her record in the file

• A member dies
– Delete his/her record from the file

• A member has moved to new location


– Search for member’s record and perform update operation

• Members with age >= 65


– Traverse the file

11
Some terminologies
• Entity:
– an entity is something, that has certain attributes which may
be assigned values
• Field:
– a single elementary unit of information representing an
attribute of an entity
• Record:
– collection of field values of a given entity
• File:
– collections of records of the entities in a given entity set

12
Data Structures Operations
• Many types of operations on data in a particular data
structure can be performed, but four are basic operations
– Traversing
– Searching
– Inserting
– Deleting
• Other two are
– Sorting
– Merging

13
Operations - Traversing
• Accessing a data item exactly once in a data structure
• Traversal makes data item available for further operations
• The data item is brought in memory during traversal

14
Operations – Searching
• Finding the location of a data item in memory
• It is the basic of all operations in data structures
• All other operation on data structure are directly dependant
upon searching operation

15
Operations - Inserting
• Adding a new data item to the data structure
• Insertion operation is successful only if there is a space in
data structure
• In case if there is no space available in data structure, then
insertion operations fails

16
Operations - Deleting
• Removing a data item from data structure
• For deletion, first of all search for the item is performed
• After successful search, data item itself is removed or is
made unavailable in data structure

17
Thank You…!

You might also like