0% found this document useful (0 votes)
61 views36 pages

Data Structures Overview and Course Guide

This document provides an introduction to the course on data structures. It discusses how data organization is important for efficient problem solving. The course will cover common data structures like arrays, linked lists, stacks, queues, trees and graphs as well as their implementation. Students will be graded based on midterm, final exams, assignments and quizzes. The document also discusses the need for data structures to organize data efficiently, different ways of organizing data physically and various file organizations like sequential, direct and index sequential files.

Uploaded by

bilal ahmad
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views36 pages

Data Structures Overview and Course Guide

This document provides an introduction to the course on data structures. It discusses how data organization is important for efficient problem solving. The course will cover common data structures like arrays, linked lists, stacks, queues, trees and graphs as well as their implementation. Students will be graded based on midterm, final exams, assignments and quizzes. The document also discusses the need for data structures to organize data efficiently, different ways of organizing data physically and various file organizations like sequential, direct and index sequential files.

Uploaded by

bilal ahmad
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Data Structures

Introduction
Lec-1

22-Sep-18 1
DATA STRUCTURES

 Very important subject

 Have already studied Introduction to programming using C

and C++ and used some data structures

 Focus was on how to carry out programming with the use of

C and C++ languages besides the resolution of different

problems.

22-Sep-18 2
DATA STRUCTURES

 In this course, we will continue problem solving and see that


the organization of data in some cases is of immense
importance.

 Therefore, the data will be stored in a special way so that the


required result should be calculated as fast as possible.

22-Sep-18 3
GOALS OF THIS COURSE

 Cover well-known data structures such as


 Arrays

 Linked lists

 Stacks
 Queues

 Tree

 Graphs.
 Implementation
22-Sep-18 4
GRADING POLICY

 Mid Term 20

 Final Term 50

 Practical / LAB Assignments 20

 Quizzes 10

Total 100

Note= 75% Attendance is compulsory for Exams 22-Sep-18

5
REFERENCE MATERIALS:
1. Data Structure by Seymour Lipschutz (Schaum’s Series)

2. Data Structures and Algorithm Analysis, Mark Allen


Weiss, Florida International University, Addison-Wesley
(latest Edition)

3. Data Structures: Abstraction and Design Using Java,


Koffman and Wolfgang, Wiley; 2nd Edition (or latest
Edition), 2010

4. Data Structures and Algorithms in C++, Adam Drozdek,


Course Technology; 4th Edition, 2012.
22-Sep-18
5. Data Structures in C++ by Aikman Series
6
6. Data Structure by Reingold & lipschutz
NEED FOR DATA STRUCTURES

 Data structures organize data  more efficient programs.

 More powerful computers  more complex applications.

 More complex applications demand more calculations.

22-Sep-18 7
ORGANIZING DATA

 Data should be arranged in a way that it is easily accessible.

 The choice of data structure and algorithm can make the

difference between a program running in a few seconds or

many days (Time Complexity).

22-Sep-18 8
EFFICIENCY

 A Program / solution is said to be efficient if it solves the


problem within its resource constraints.

Space

Time

 The cost of a solution is the amount of resources that the


solution consumes.

22-Sep-18 9
EFFICIENCY

 This means that we have to write programs considering the


resources to achieve some solution as soon as possible.

 The cost of a solution is the amount of resources (Memory /


Running Time) that the solution consumes.

22-Sep-18 10
SELECTING A DATA STRUCTURE

Select a data structure as follows:

1. Analyze the problem to determine the resource constraints a

solution must meet.

2. Determine the basic operations that must be supported.

3. Select the data structure that best meets these requirements.

22-Sep-18 11
DATA STRUCTURE PHILOSOPHY

 Each data structure has costs/Disadvantages and benefits.

 In different situations, different data structures will be suitable.

22-Sep-18 12
PHYSICAL DATA REPRESENTATION

22-Sep-18 13
PHYSICAL DATA REPRESENTATION

 Data are simply values or set of values

 A data item refers to a single unit of values

 Data items group items / elementary items

22-Sep-18 14
PHYSICAL DATA REPRESENTATION

 An entity is something that has certain attributes or properties


which may be assigned values

 Field is a single elementary unit of information representing a


property of an entity

 Record is the collection of field values of a given entity

22-Sep-18 15
PHYSICAL DATA REPRESENTATION

 File is the collection of records

 Each record in a field may contain many field items, but the

value in a certain field may uniquely determine the record in the

file primary key

22-Sep-18 16
FILE ORGANIZATIONS

22-Sep-18 17
FILE ORGANIZATIONS

 The structure of a file (especially a data file), defined in


terms of its components and how they are mapped onto
backing store(secodary memory ).

 basic factor which determines the organization of a file

 is the nature of operations that are to be performed on the


files.

22-Sep-18 18
FILE ORGANIZATIONS

 The possible operations performed can be:

– Retrieval

– Processing

– Selection

– Updation

– Deletion

22-Sep-18 19
FILE ORGANIZATIONS
 Organization of files depend upon:

– File storage access method

– Number of records, record size, block size and hence


size of the file

– Length of records either fixed or variable

22-Sep-18 20
FILE ORGANIZATIONS

 Organization of files depend upon:

– Frequency of operations to be performed

– Response time required to complete an operation

– Security provisions for data handling

22-Sep-18 21
FILE ORGANIZATIONS

 Keeping in view these points, there are three commonly


used file organizations.

1. Sequential Files

2. Index Sequential Files

3. Direct or Random Access Files

22-Sep-18 22
SEQUENTIAL FILES
 Records are stored one after the other on a storage
device based on the value of the search key of each
record.

 Processing same order

 All secondary storage devices support sequential file


organization.

 Access time varies according to location Why?


22-Sep-18 23
SEQUENTIAL FILES

 To arrive at a certain location means to pass through all


the precedence locations.

 More time taken in sorting and merging them

 The next figure shows a record of a sequential file.

22-Sep-18 24
SEQUENTIAL FILES

22-Sep-18 25
SEQUENTIAL FILES

 Storage devices on which we can store in this manner are


 Before > Punched Cards
 Now > Magnetic Disks, Magnetic Tapes

 Advantages ?

 Disadvantages ?

22-Sep-18 26
DISADVANTAGES OF SEQUENTIAL
FILE ORGANIZATION

• To access a specific file, we need to access all the previous


files.

• Process is slow in huge files.

• Files are stored one after another, there is gap between the
file to insert new.

• Difficult to delete the record, all the records will be


rearranged.
DIRECT/RANDOM ACCESS
FILES

 Each has unique address location>separate field or extracted

through hashing

22-Sep-18 29
DIRECT FILE ORGANIZATION:
 It overcomes the problem of sequential method

 Records stored at random places

 Each record accessed directly irrespective of its location

 Access desired record randomly or directly.

 Individual address is allocated to each record of the file.

 Using fields key value we can access the desired record without

access the previous record.

 Online ticket reservation is an example.

 DFO can be created on magnetic Disks but not in magnetic tapes.


DIRECT/RANDOM ACCESS
FILES

 Advantages ?
 No need of separate transaction file
 Fast retrieval of records

 Disadvantages ?
 Possibility of less efficient use of storage space
 Collision

22-Sep-18 31
INDEX SEQUENTIAL FILES

 Have qualities of both sequential and direct methods

 Records stored in sorted order by record key as sequential

method

 An index also maintained for direct accessing as direct

method

 The index consists of record keys and their corresponding

addresses
22-Sep-18 32
INDEX SEQUENTIAL FILES

 The index is searched and the key is located which then

provides the address for access

 Thus as file is sequential but can be updated randomly

 Devices > Magnetic Disks, Magnetic Drums

22-Sep-18 33
22-Sep-18 34
INDEX SEQUENTIAL FILES
 Advantages ?
 When activity ratio less efficiently use of sequential
method
 When activity ratio more efficiently use of direct
method
 Disadvantages ?
 Extra storage required
 Access of a record slower than the direct files

22-Sep-18 35
ASSIGNMENT # 1

 Solve questions of Schaum’s Series book in your own words

 1.1
 1.2
 1.3
 1.4

22-Sep-18 36

Common questions

Powered by AI

Sequential file organization stores records one after the other and requires accessing all preceding records to reach a specific one. It tends to be slow with large files but is supported by all secondary storage devices. Direct or random access file organization allows records to be accessed directly without the need to traverse preceding records, using unique addresses or key values, making it suitable for fast retrieval scenarios like online ticket reservations. Index-sequential file organization combines the qualities of both, with records stored sequentially but also indexed for quick lookup, offering a balance between the sequential and direct methods .

While direct access file organization offers the advantage of rapid data retrieval by allowing records to be accessed individually and independently, it can lead to challenges such as less efficient use of storage space and collision problems where multiple records compete for the same storage location. In contrast, sequential file organization uses space more uniformly, but at the cost of slower access times, especially when dealing with large datasets .

Assessing a data structure's suitability for a specific application involves analyzing the problem to determine its resource constraints, identifying the basic operations that need support, and selecting a data structure that optimally meets these requirements. This assessment requires an understanding of the costs and benefits associated with each data structure and considering factors such as time complexity, space consumption, ease of implementation, and the specific operational needs of the application .

The physical representation of data, including its organization into fields, records, and files, directly impacts its handling and processing. Each data item constitutes a single unit of value, and entities consist of attributes that may be assigned values. A field holds information about a single property, while a record is a collection of these field values. Files, being collections of records, can be organized in various ways, impacting operations like retrieval, processing, and updating based on factors such as file storage access method, record sizes, and response time requirements .

Data structures are fundamental for efficient program design because they organize data in a way that allows for more efficient data access and manipulation, which in turn leads to more efficient programs. As applications become more complex with the advent of more powerful computers, they demand more calculations, which necessitates efficient data management to ensure software runs efficiently within its resource constraints, such as time and space .

Sequential file organization, particularly with larger data sets, can suffer from disadvantages like increased access times, as accessing a specific file requires passing through all prior files. It is inefficient in terms of data retrieval speed, as the process is inherently slow for large files. Furthermore, inserting new records is cumbersome due to gaps, and deleting records necessitates rearranging the entire file, making it inefficient for frequent updates and modifications .

The philosophical considerations when choosing between different data structures involve recognizing that each data structure has inherent costs and benefits and that their suitability can vary depending on the context of their use. One must appreciate how a data structure's design affects both the efficiency and complexity of the operations performed on it, and align these characteristics with the specific requirements of the task at hand, balancing resource constraints and the need for speed and efficiency .

Data representation choices, which involve organizing data into fields, records, and files, directly influence file organization by determining how files are stored and accessed. This impacts retrieval speeds and storage efficiency, with considerations such as fixed versus variable record lengths, the frequency of access operations, and the security requirements for handling data guiding these choices. The method of storing data impacts whether a sequential, index-sequential, or direct file organization is most appropriate .

Efficient data storage organization enhances computing capabilities by minimizing the time required to access data and reducing the computational overhead associated with data processing. By using well-chosen data structures, programs can operate within their resource constraints, achieve faster computation speeds, and handle more complex tasks with greater efficiency, thus significantly improving the overall performance and capability of computing systems .

Index-sequential file organization is more advantageous in scenarios where a balance between fast access and efficient storage is required. It benefits applications where the activity ratio—the frequency of operations like updates—is moderate. This file organization allows sequential processing of data while providing random access capability via indexing. Thus, when operations are frequent and need efficient processing without compromising access time too much, index-sequential becomes beneficial over purely sequential or direct methods .

You might also like