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

WWW Engineeringgyan in 2024 03 Elementary Data Organization HTML M 1

Uploaded by

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

WWW Engineeringgyan in 2024 03 Elementary Data Organization HTML M 1

Uploaded by

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

  

Home  SOFTWARE ENGINEERING  Elementary Data Organization

Elementary Data Organization


By - Engineering Gyan  March 09, 2024  0

Elementary Data Organization


Data
It is defined as elementary value or the set of value.

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.

Data Structure Operations


The data appearing in our data structures are Processed by means of certain operations.

(i) Inserting: Adding a new record to the structure.

(ii) Deleting: Removing a record from the structure.

(iii) Searching: Finding the location of the record in the structure.


(iv) Traversing: Accessing each record exactly once So that certain items in the record may be
processed. (this accessing and processing is sometimes called "visiting" the record.)

(v) Sorting: Arranging the records in some logical order.

(vi) Merging: combining the records in two different sorted files into a single sorted file.

Classification Of Data Structure

Primitive Data Structure


The data structure that directly Operate upon the machine instruction. These are Predefined
Operation & properties.

Non-Primitive Data Structure


It derived from Primitive and not directly operate upon machine.

Difference Between Linear And Non-linear Data Structure


Abstract Data Type (ADT)
ADT refers to a Set of Value associated with operation or function. with ADT we know what a
Specific data type can do but how it is actually does it hidden.

Design And Analysis Of Algorithms

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.

(ii) Output: Must produce at least one Value.

(iii) Finiteness: Must have ending.

(iv) Definiteness: Each step must be clear and unambigous.

(v) Effectiveness: Every instruction should be clear. it should not be complex

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.

There are two types of complexity.


(I) Time Complexity: Amount of computer time need to run to completion.

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)

(iii) Nested Loop: (p2)


for i ← 1 to n →n
for j ← 1 to n → n.n → n^2 O(n^2)
s ← s + a[i] → n.n.1 → n^2

(iv) Conscutive Statement:


P1 → n
P2 → n^2 O(n^2)

(vi) While Loop:

while (n>0) while (n>0)


{ {
i ← i+1 O(logn) j ← j+1 O(n)
n ← n/2 n ← n-2
} }

(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)

Time Complexity Examples


ex:(i) Sub (a ,n) = T (let)
{
S = 0.0 → 1
for i = 1 to n do → n+1 3+2n = O(n)
S = S + a[i] → n
return S → 1
}

ex:(ii) Product [a(1......m,1......n), b(1.....n,1.....p)]


for i ← t to m do → m+1
for i ← t to p do → (p+1)m
C[i, j] ⇐ 0 →m.p
for k ← 1 to n do →m.p(n+1)
C[i, j] ← C[i, j] + a[j, k]*b [k, j] →m.p.n
return C[1.....m, 1.....P] →1
T = m +1 + m(P + 1) + mp + mp(n + 1) + mpn
= O(m.p.n)

(II) Space Complexity: Amount of memory time need run to completion.


Space Complexity

(SP) = (Constant + Space) + Auxiliary Space


↑ ↑
(Input, local variable) ( Temporary/ Variable)

ex: abc (a, b, c)


{
return a + b + b*c + (b + b - c) / a + b + 4.0;
}
∴ SP = 1+1+1
=3 = O(1)
ex: Sum (a, n)
{
S=0
for i = 1 to n do
S = S + a[i]
return S:
}
∴ SP = (nx1 +1 +1 +1)
= (n+2)+1
= O(1)

ex: def Rsum (a, n)


if n ≤ 0
return 0
else
return a [-1]+ Rsum [a (: -2], n-1]
∴ SP = n
=O(n)

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.

1. Big-oh (O) → Upper Bound


2. Big Omega(Ω) → Lower Bound
3. Theta(θ) → Average Bound
4. Small-oh (o)
5. Small omega(ω)

(i) Big-oh (O): The function f(n) = O.g(n) if there exist positive constant C, and no such that

f(n) ≤ c.g(n) for all n, n ≥ n(not)


C>0
ex: f(n) = 3n+2 ,g(n) = n
f(n) ≤ c.g(n)
3n+2 ≤ c.g(n)
⇒ 3n+2 ≤ 4 (n)
at, C = 4
n = 1,2,3........
∴ f(n) = O(n)
for all
C=4
n≥2

(ii)Big- Omega (Ω): The function f(n) = Ω.g(n) if there exist positive constant C and n(not) such that

f(n) ≥c.g(n) for all n, n ≥ n(not)


C>0

ex: f(n) = 3n+2 ,g(n) = n


f(n) ≥ c.g(n)
C>0
n(not) > 0
3n+2 ≥ c.n
⇒ 3n+2 ≥ 3n
C=3
n≥1
∴ f(n) = Ω(n)
for C = 3
and n ≥ 1

(iii) Theta (θ): The function f(n) = θ.g(n) if there exist positive constant c1, c2 and n(not) such that

C1g(n) ≤ f(n) ≤ C2g(n); for all n, n ≥ n(not)


C1, C2 ≥ 0

ex: f(n) = 3n+2, g(n) = n


C1n ≤ 3n+2 ≤ C2n
C1 = 3 C2=4
n≥1 n≥2
∴ f(n) = O(n) for all
C1 = 3
C2 = 4; n ≥ 2

Time-Space Trade Off


Time-Space is a way of of solving problem;

(i) In less time by using more memory.


(ii) In less memory or space by using more time.
Suppose a file is sorted numerically by social Security number. As new records are inserted into
the file, data must be constantly moved to new locations in order to maintain the sorted order.

Searching
Searching is a method to finding an element from data structure with their appropriate location.

Searching are of two types.

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.

Read Also: Software Design Principles


Read Also: Operating System Service In OS

 Tags SOFTWARE ENGINEERING

 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.

 YOU MAY LIKE Show more

Process Management In Function Of Operating System Evolution Of Operating System


Operating System  June 04, 2024  June 02, 2024
 June 05, 2024

POST A COMMENT 0 Comments


* Please Don't Spam Here. All the Comments are Reviewed by Admin.

To leave a comment, click the button below to sign in with Google.

SIGN IN WITH GOOGLE

 POPULAR POSTS

SOFTWARE ENGINEERING

Elementary Data Organization


 March 09, 2024

PPS Notes B tech 1st Year


 April 14, 2024

Operating System Service In OS


 May 25, 2024

Types Of Lines In Engineering Drawing


 March 01, 2024

 MOST RECENT
Lasers- Types Of Lasers, Applications Of Lasers Atomic Structure Class 11 Notes
 September 27, 2024  September 15, 2024

Stoichiometry Class 11 Band Theory Of Solids


 September 11, 2024  September 07, 2024

 ABOUT ME

Engineering Gyan
View my complete profile

 SEARCH THIS BLOG

Search this blog Search

 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

    

About us Contact us Privacy Policy Disclaimer Terms DMCA


Copyright © 2024 ENGINEERING GYAN All Right Reseved

You might also like