0% found this document useful (0 votes)
2 views21 pages

Unit 1 Data Structure

Uploaded by

deepti_chaudhari
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
0% found this document useful (0 votes)
2 views21 pages

Unit 1 Data Structure

Uploaded by

deepti_chaudhari
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 21

Data Structures using c

UNIT 1
BY. DEEPTI CHAUDHARI
CONTENTS
1.Data
2.Data types
3.Data Structure
4.Abstract Data Type(ADT)
5.Characteristics of Algorithm
6.Analyzing Program
1. Data
• Data is the basic fact or entity that is utilized in calculation or
manipulation.
• Data may be a single value or it may be a set of values

2. Data Types
Integer, float, char, string, double, long int
3. Data Structure
• Data structure allows us to understand the organization of data and the
management of the data flow in order to increase the efficiency of any
process or program. Data Structure is a particular way of storing and
organizing data in the memory of the computer so that these data can
easily be retrieved and efficiently utilized in the future when required. The
data can be managed in various ways, like the logical or mathematical
model for a specific organization of data is known as a data structure.
• Data structure mainly specifies
1. Organization of data
2. Accessing Methods
3. Degree of Associativity
4. Processing of alternatives for information
Classification of Data Structure
Non-Primitive Data Structures

• The non-primitive data structures emphasize the structuring of a


group of homogeneous or heterogeneous data items.
• Example of Non-Primitive Data Structures
1. Arrays
2. Lists
3. Files
4. Stacks
5. Queues
6. Graphs
7. trees
1. Arrays
An array is defined as it is a collection of items stored at contiguous memory
locations. we can also say that arrays are the set of homogeneous data
elements stored in RAM, therefore, it can hold only one type of data.
2. Lists
A Lists is defined as it is a collection of a variable number of data items.
lists or sequence is an abstract data type, which always represents a
countable number of ordered values, Every list element contains at least
two fields, one field is used for storing the data and another filed is used
for storing the address of the next element.
3. Files
Files contain information, and this information stored permanently in the
Hard Disk and Floppy Disk, this disk also knows as a secondary storage
device. you can store a little byte of data and a large amount of data in
secondary devices.
therefore, A file name always contains the primary and secondary name and
dot(.) is used for separating. for understanding in a better way see the below
Diagram
4. Stack
A stack is a basic data structure, it’s defined as an ordered collection of elements
represented by a real physical stack.
Liner data structure features insertion and deletion of items take place at one end
called top of the stack.
Therefore, In these structure data set as a stack of books or plates, in the stack, you
can remove the item from the top order. you can use these concepts or structures all
throughout programming. the implementation of the stack also know as LIFO (Last in
First Out)
these are the three basic concepts that can be performed on stacks.
1) push (insert the items into a stack)
2) Pop (delete an item from the stack)
5. Queue
Queue defined (FIFO) First In First Out type of data structure. Queues are
also the part of non-primitive linear data structure, therefore in Queues
process, we can insert an element in a queue from the REAR end and delete
an element from the FRONT end only.
Therefore, Implement queues with using two ways:
 Pointers
 Arrays
6. Graphs
There are different types of graphs :
1. Connected Graph
2. Non-Connected Graph
3. Directed Graph
4. Non-Directed Graph
therefore, graphs are the non-linear and non-primitive type of data
structure. graph is representing the different types of physical design
structures.
7. Trees
In the classification of data structure, Trees also come in the non-
primitive and non-linear category data structure, using tree we can
represent a hierarchical relationship between the data elements.
Data Structure the most commonly used operations
As a result, in the Classification of Data Structure, Data Structure the most
commonly used operations are broadly categorized into four types:
(1) Create
(2) Delete
(3) Selection
(4) Update
CREATE operation
The CREATE operation (it can be defined) results in reserving memory for
the program elements.
This can be done by a declaration statement.
The creation of data structure may take place either during compile -time
or during Runtime.
DELETE operation
therefore, on the other hand, DELETE operation destroys the memory space
allocated for the specified data structure Malloc() and free ()
as a result, the function of C language is used for these two operations
respectively.
The SELECTION operation
The SELECTION operation can be defined as its deals with accessing
particular data within a data structure.
And the last operations UPDATE, as the name implies, it updates or
modifies the data in the data structure.
hence, in the Classification of Data Structure the operation Probably new
data may be entered or previously stored data may be deleted.
Abstract Data Type(ADT)
Abstract Data type (ADT) is a type (or class) for objects whose behaviour
is defined by a set of value and a set of operations.
The definition of ADT only mentions what operations are to be
performed but not how these operations will be implemented. It does not
specify how data will be organized in memory and what algorithms will
be used for implementing the operations. It is called “abstract” because it
gives an implementation-independent view. The process of providing
only the essentials and hiding the details is known as abstraction.
Characteristics of Algorithm
Algorithm is a step-by-step procedure, which defines a set of instructions
to be executed in a certain order to get the desired output. Algorithms
are generally created independent of underlying languages, i.e. an
algorithm can be implemented in more than one programming language.

An algorithm should have the following characteristics −


1.Unambiguous − Algorithm should be clear and unambiguous. Each of
its steps (or phases), and their inputs/outputs should be clear and must
lead to only one meaning.
2. Input − An algorithm should have 0 or more well-defined inputs.
3. Output − An algorithm should have 1 or more well-defined outputs,
and should match the desired output.
4. Finiteness − Algorithms must terminate after a finite number of steps.
5.Feasibility − Should be feasible with the available resources.
6. Independent − An algorithm should have step-by-step directions,
which should be independent of any programming code.
Problem − Design an algorithm to add two numbers and display the result.

Step 1 − START
Step 2 − declare three integers a, b & c
Step 3 − define values of a & b
Step 4 − add values of a & b
Step 5 − store output of step 4 to c
Step 6 − print c
Step 7 − STOP
programs
 1 factorial of a number
 Fibbonacci series generation
 Reverse number (any digit 2,3,4)
 Calculating power of number
 Prime number checking
Fobbonacci series
 0 1 1 2 3 5 8 13

You might also like