Page 13 - DCAP605_ADVANCED_DATA_STRUCTURE_AND_ALGORITHMS
P. 13
Advanced Data Structure and Algorithms
Notes Let A1, A2 be two Address1 type variables and B1, B2 be two address2 type variables. The data
can now be stored in the following way:
A1 N 59, Sriniwaspuri, New Delhi 1100065
A2 House No.: N 59 Street:
City: Sriniwaspuri State: Delhi PIN: 110065
One can access different fields of A2 as shown below:
A 2.HouseNo = N 59
A 2.Street = “ ”
A 2.City = “Sriniwaspuri”
A 2.State = “New Delhi”
A 2.PIN = “110065”
Data structure is a combination of one or more basic data types to form a single addressable data
type along with operations defined on it.
Note It is a data type and hence one can create variables of that type in a computer
program. Just as each basic data type allows programmers to perform certain operations,
data structures also let programmers operate on them.
Data Abstraction: Data abstraction is a tool that allows each data structure to be developed in
relative isolation from the rest of the solution. The study of data structure is organized around a
collection of abstract data types that includes lists, trees, sets, graphs, and dictionaries.
1.3 Data Structure Operations
The data appearing in our data structure is processed by means of certain operations. 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:
1. Transversing: 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.)
2. 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.
3. Inserting: Adding new records to the structure.
4. Deleting: Removing a record from the structure.
Sometimes two or more data structure of operations may be used in a given situation; e.g., we
may want to delete the record with a given key, which may mean we first need to search for the
location of the record.
8 LOVELY PROFESSIONAL UNIVERSITY