Data Structure
➢ Data
Data means information or set of values is called data.
➢ Data item
A single unit of value is called data item.
• Types of data item
1. Group item
A item which can divided into sub items called as group item
Eg:- student name can be divided into three sub items, that are first_name,
middle_name and last_name
2. Elementary item
A item which cannot divided into sub items called ad elementary items.
Eg:- Student roll_no cannot be divided into sub items.
➢ Entity
Entity is an object which has certain value.
➢ Entity set
Collection of entities called entity set.
➢ Information
A meaningful data is called information.
➢ Field
A single elementary unit is called field (column).
➢ Record
Collection of field is called record (row).
➢ File
Collection of record is called file.
➢ Primary key
A field which has unique value called primary key.
Eg:- In a student data name of more than one student may be same but the roll
number of each student is unique so roll_no field is a primary key.
➢ Data Structure
It is mathematical and logical model of an organization.
Here different data items are related with each other logically.
Eg:- Array, Record, Linked list, Tree, Stack, and Queue.
,• Types of data structure
1. Linear data structure
In this data items are stored sequentially one by one in consecutive memory
locations.
Eg:- Array, Record, Linked list, Stack, and Queue.
2. Non-linear data structure
In this data items are stored hierarchically means linear order cannot be maintained.
Eg:- Tree.
➢ Data Structure operations
1. Traversing
Accessing each element only once is called as traversing.
2. Inserting
Adding new element to the structure is called as inserting.
3. Deleting
Removing element from the structure is called as deleting.
4. Searching
Finding location of element is called as searching.
5. Sorting
Re-arranging elements in some logical order is called as sorting.
6. Merging
Combining two records in a single file is called as merging.
➢ Algorithmic notations
- Algorithm is stepwise representation of program.
- Algorithm divided into two parts,
First part tells the purpose of algorithm, variable list, and input data.
Second part is a list of steps.
- If we want to transfer control of program to a particular step then we can use ‘goto’
statement i.e. goto step n.
- The exit or stop shows completion of algorithm.
Eg:- 1.
Step 1: start
Step 2: :
Step 3: :
Step 4: :
Step 5: :
Eg:- 2.
Step 1: start
Step 2: :
Step 3: goto step 5
Step 4: :
Step 5: :
, ➢ Control Flow/ Control Logic/ Control Structure
Control flows are used to control flow of program.
• These are of three types
1. Sequential control flow
2. Conditional control flow
3. Looping control flow
1. Sequential control flow
- In this modules of algorithm executed one by one.
Module A
Module B
Module n
2. Conditional control flow/Selection control flow/Branching control flow
- In this modules are selected or executed depending on condition.
- There are three types of conditional flow
i. Single alternative
ii. Double alternative
iii. Multiple alternative
i. Single alternative
- It has only one condition and having only one alternate path.
If condn
No
Yes
Module A