0% found this document useful (0 votes)
23 views15 pages

Data Structure

Uploaded by

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

Data Structure

Uploaded by

bashirkhankk44
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Data Structures

Chapter 1 Introduction

Presented by: Jawad Akhtar


Department of Computer Science
GDC Hayatabad
Idea of computer science
• Computer science deals with solving a problem correctly in the form of
Algorithm which then can be converted into a program, in most efficient
time and memory.
• Problem --> Solution (Algorithm)  Program (Efficient)
Basic for programmer
• To write an efficient program we need knowledge of both Data Structures
and Algorithms.
• DATA STRUCTURE + ALGORITHM = PROGRAM'
Why we study data structure and
algorithms
• Course objective is to teach you how to code efficiently.
• What is the meaning of efficiency (time, space, battery, system buses,
register etc) time is considered as most important.
• Better running time is obtained from the use of most appropriate data
structure and algorithms, rather than through removing a few statements
by clever coding.
What is data structure
• Data structure is a particular way of organizing data in a computer
memory (cache, main, secondary) so that Memory can be used efficiently
both in terms of time and space.
• It is a logical relationship existing between individual elements of data, it
considers elements stored and also their relationship to each other.
Data structure
• Data structure mainly specifies the following four things
• Organization of data
• Accessing methods
• Degree of association
• Processing methods
Effect of Data Structures
• Data structure effect both the structural and functional aspects of the
program.
• Different kinds of data structures are suited to different kinds of
applications, and some are highly specialized to specific tasks, For
example.
• • Relational databases commonly use B-tree indexes for data retrieval
Compiler implementations usually use hash tables to look up identifiers.
Effect of Data Structures

• Usually, efficient data structures are key to designing efficient algorithms.


Some formal design methods and programming languages emphasize data
structures, rather than algorithms, as the key organizing factor in software
design.
• The implementation of a data structure usually requires writing a set of
procedures that create and manipulate instances of that structure.
Primitive data structure
• Primitive data structures are those which have predefined way of storing
data by the system. And the set of operations that can be performed on
these data are also predefined. They are directly operated upon by the
machine instruction.
• Primitive data structures are char, int, float, double. The predefined
operations are addition, subtraction, etc.
Non-Primitive data structure
• But there are certain situations when primitive data structures are not
sufficient for our job. There comes derived data structures and user
defined data structures.
• Derived data structures are also provided by the system but are made
using primitives like an array. It can be array of chars, array of int, etc. The
set of operations that can be performed on derived data structures are
also predefined.
• Finally, there are user defined data types which the user defines using the
primitive and derived data types using language constructs like structure
or class and uses according to their needs. And the user has to define the
set or operations that we can perform on them. User defines data types
are Linked Lists, Trees, etc.
LINEAR DATA STRUCTURE NON-LINEAR DATA STRUCTURE

In a linear data structure, data elements In a non-linear data structure, data


are arranged in a linear order where each elements are attached in hierarchical
and every element are attached to its manner
previous and next adjacent
In linear data structure, single level is Whereas in non-linear data structure,
involved multiple levels are involved.

Its implementation is easy in comparison While its implementation is complex in


to non- linear data structure. comparison to linear data structure.

In linear data structure, data elements can While in non-linear data structure, data
be traversed in a single run only elements can't be traversed in a single run
only
Its example are: array, stack , queue, link- While its examples are: trees and graphs
list etc.
Data
• Homogeneous data: Homogeneous data structures are those data
structures that contain only similar type of data e.g. like a data structure
containing only integer or float values. The simplest example of such type
of data structures is an Array.
• Heterogeneous Data: Heterogeneous Data Structures are those data
structures that contains a variety or dissimilar type of data, for e.g. a data
structure that can contain various data of different data types like integer,
float and character. The examples of such data structures include
structures, union etc.
Common Operations on Data
Structures
• Insertion
– The operation that add a new data element item in a data structure
• Deletion
– Deletion operation removes a data elements from a data structure
• Traversing
– Accessing each data element in a data structure in order to perform some data
processing.
• Searching
– Finding data elements in a structure that contains some value or meets some search
criteria or condition.
• Sorting
– Arranging data elements in some order. For example, ascending or descending order.
– Sorting data has many useful applications.
• Merging
– Combining records in two different data structures in to one data structure.

You might also like