WWW Engineeringgyan in 2024 03 Elementary Data Organization HTML M 1
WWW Engineeringgyan in 2024 03 Elementary Data Organization HTML M 1
Data Item
A data item refers to a single unit of values.
Structure
Structure is a user-defined data type in c language which allows us to combine data of different
types together.
Data Structure
Data may be organized in many different ways; the logical or mathematical model of a particular
organization of data is called a data structure.
Record
It is the collection of various data item.
File
It is the collection of record of one type.
Entity
It has certain attributes or properties which may be assign value.
Attribute
It is the property of Entity.
Field
It is the single elementary unit of information representing an attribute of Entity.
Information
It is the data with attributes, meaningful data.
(vi) Merging: combining the records in two different sorted files into a single sorted file.
The word "Algorithm" comes from name of Parsian Author Abu Ja'far Mohammad in 825 A.D.
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.
Criteria Of Algorithm
(i) Input: Zero or more input.
Analyzing Algorithm
Analyzing of Algorithm is require to dectate the correctness and Measurement the efficiency of
Algorithm.
Efficiency Of Algorithm
Types Of Analysis
There are three types of Analysis.
(i) Worst Case: Maximum number of steps taken on any instance of size 'n'.
(ii) Best Case: Minimum number of steps taken on any instance of size 'n'.
(iii) Average Case: Any Average number of steps taken on any instance of size 'n'.
Complexity Of An Algorithm
The complexity of an algorithm is a function f(n), which measures the time and/or space used by
an algorithm in terms of the input size n.
Rules
(i) Single Statement: (P1)
C=a+b → O(1)
(ii) Loop:
for i ← 1 to n → n
s ← s + a[i] → n.1 O(n)
(vii) Recursion:
fact (n) fib(n)
if n <= 1 if n <= 1
return 1 O(n) return 1
else else
return n*fact(n-1) returnfib(n-1)+fib(n-2)
Tn = t(n-1) + t(n-2)
Growth Of Function
1 < logn < √n < n <nlogn < n² <n³.. 2^n < 3 ^n <.. <n^n
Asymptotic Notation
Asymptotic notation are mathematical tool to represent complexity in term of time and space.
(i) Big-oh (O): The function f(n) = O.g(n) if there exist positive constant C, and no such that
(ii)Big- Omega (Ω): The function f(n) = Ω.g(n) if there exist positive constant C and n(not) such that
(iii) Theta (θ): The function f(n) = θ.g(n) if there exist positive constant c1, c2 and n(not) such that
Searching
Searching is a method to finding an element from data structure with their appropriate location.
Linear Search
It is a Very basic and simple Search algorithm. In linear search we search an element in given array
by traversing the array from the Starting till the desired element is found.
Algorithm
Step1: Begin
Step 2: Set a [s] ← {10, 20, 30, 40, 50}
Step 3: Set i=0
Step 4: input searching item
Step5: Repeat step(6) & Step (7) while i<5
Step 6: if a[i] = item then
print item found of location = i & exit
Step 7: i ← i+1
Step 8: if i≥5 then
print item not found
Step 9: end
Binary Search
In binary search, we search an element from a sorted list of items
Algorithm
Step 1: Initialize two pointers, left and right, to the beginning and end of the array, respectively.
Step 2: Calculate the middle index as mid using the formula: mid = (left + right) /2
Step 3: Compare the element at mid with the target element:
If they are equal, you have found the target element; return mid.
If the element at mid is greater than the target, update right = mid- 1 to search in the left half
of the array.
If the element at mid is less than the target, update left = mid +1 to search in the right half of
the array.
Step 4: Repeat Step (2) & Step (3) untill left is less than or equal to right.
Step 5: If the loop exits and the target element is not found, return a valve (e.g., -1) to indicate that
the element is not in the array.
Share:
OLDER NEWER
Types Of Lines In Engineering Drawing PPS Notes B tech 1st Year
Engineering Gyan
Hello friends, Welcome to Engineering gyan. my name is Santosh Kumar. I am a Student of B.Tech (cse) 3rd
year. I have a special love for Technology, Coding and Education. I have good knowledge of Motivation,
Engineering and Study Tips.
POPULAR POSTS
SOFTWARE ENGINEERING
MOST RECENT
Lasers- Types Of Lasers, Applications Of Lasers Atomic Structure Class 11 Notes
September 27, 2024 September 15, 2024
ABOUT ME
Engineering Gyan
View my complete profile
LABELS
CHEMISTRY
Hardware Engineering
MATHEMATICS
PHYSICS
SOFTWARE ENGINEERING
ABOUT US
Hello friends, Welcome to Engineering gyan. my name is Santosh Kumar. I am a Student of B.Tech (cse)
3rd year. I have a special love for Technology, Coding and Education. I have good knowledge of
Motivation, Engineering and Study Tips.
FOLLOW US