Professional Documents
Culture Documents
Lecture-1 179 1
Lecture-1 179 1
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
4
Data - classes
5
structure
• Ways of representation of something
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
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
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…!