SlideShare ist ein Scribd-Unternehmen logo
1 von 11
Downloaden Sie, um offline zu lesen
For More Visit: Https://www.ThesisScientist.com
Unit 2
Introduction to Data Structure
Introduction
A computer is a machine that manipulates information. The study of Computer Science includes the study
of how information is organized in a Computer, how it can be manipulated and how it can be utilized. Thus,
it is exceedingly important to understand the concept of information organization and manipulation.
Computer Science can be defined as the study of the data, its representation and transformation by a digital
computer.
Data Structure
Data may be organized in many different ways; the logical or mathematical model of a particular
organization of data is called "Data Structure". The choice of a particular data model depends on two
considerations:
 It must be rich enough in structure to reflect the actual relationships of the data in the real world.
 The structure should be simple enough that one can effectively process the data when necessary.
Data Structure Operations
The particular data structure that one chooses for a given situation depends largely on the nature of specific
operations to be performed.
The following are the four major operations associated with any data structure:
i. Traversing : Accessing each record exactly once so that certain items in the record may be
processed.
ii. Searching : Finding the location of the record with a given key value, or finding the locations
of all records which satisfy one or more conditions.
iii. Inserting : Adding a new record to the structure.
iv. Deleting : Removing a record from the structure.
Primitive and Composite Data Types
Primitive Data Types are Basic data types of any language. In most computers these are native to the
machine's hardware.
Some Primitive data types are:
 Integer
For More Visit: Https://www.ThesisScientist.com
 Character
 Real Number
 Logical Number
 Pointers
Integer
A quantity representing objects that are discrete in nature can be represented by an integer.
Ex. 2, 0, -56, 89998 etc. are integers
Ex. 34.89, -3.98, abc, uii*^lkd889 are not integers
Character
Information is not always interpreted numerically. Items such as names, job, addresses etc. must also be
represented in some fashion within a computer.
Character is a literal expression of some element selected from an alphabet. A wide variety of character sets
(or alphabets) are handled by the most popular computers. Two of the largest and most widely used
character sets are represented by EBDIC and ASCII.
Ex. „A‟, „b‟, „/‟, „*‟, ‟5‟ etc. are characters
Ex. 23, 45.5, “AJHJHA”, 7&^&* are not characters
Real Number
The usual method used by computers to represent real numbers is floating-point notation. There are many
varieties of floating point notation and each has individual characteristics. The key concept is that a real
number is represented by a number, called a mantissa, times a base raised to an integer power called an
exponent. The base is usually fixed, and the mantissa and exponent vary to represent different real
numbers.
Example : If the base is fixed at 10, the number 485.43 can be represented as 48543×10-2
.
Logical Number
A logical data item is a primitive data type that can assume the values of either TRUE or FALSE.
Pointers
A pointer is a reference to a data structure. As pointer is a single fixed-size data item, it provides a
homogeneous method of referencing any data structure, regardless of the structure's type or complexity. In
some instance the pointers permit faster insertion and deletion of elements to and from a data structure.
Int x; Here x is an integer type while p is a pointer to integer type.
Int *p;
For More Visit: Https://www.ThesisScientist.com
Abstract Data Type
A tool that permits a designer to consider a component at an abstract level, without worrying about the
details of its implementation is called ABSTRACTION. Treating the data as objects with some predefined
operations that can be performed on those objects is called Data Abstraction.
Data Abstraction when supported as a data types in a language is called Abstract Data Type (ADT). ADT
is a useful tool for specifying the logical properties of a data type.
The term "Abstract Data Type" refers to the basic mathematical concept that defines the data type.
Ex. Integer is an abstraction of a numerical quantity which is a whole number and can be positive or
negative.
Ex. Point is an abstraction of a two dimensional figure having no length and breadth.
Atomic Type
It is a value (constant or variable), which is treated as single entity only and cannot be subdivided.
Integers, reals, characters type of data cannot be broken further into any simpler data types, therefore, these
are atomic type.
Whereas, name of a person is not an atomic type data, because it can be broken into first name and last
name. Also, first and last names can be further broken into character type.
Structured Type
It is a set of values, which has two ingredients:
i) It is made up of COMPONENT elements.
ii) There is a structure, i.e. a set of rules for putting the components together.
Ex. Address is a structured type data : it has components – house No., Street No., City etc.
Ex. Date of birth is a structured data : it has day, moth and year data items.
Refinement Stages
Stages from any mathematical concept to its implementation as application are as follows:
Example 1
For More Visit: Https://www.ThesisScientist.com
Any Sequence
Queue
Linear Circular
Array With Counter Array With Flag
Airport Simulation
Introduction to Algorithm Design
Algorithm
An algorithm is a well-defined list of steps for solving a particular problem. In other words an algorithm is
a finite step by step list of well-defined instructions for solving a particular problem. The steps of the
algorithm are executed one after the other, beginning with step 1.
Algorithms and their equivalent computer programs are more easily understood if they mainly use self-
contained modules and three types of logic, or flow of control called
1. Sequence Logic or Sequential Logic
2. Selection or Conditional Logic
3. Iteration or Repetitive Logic
In "Sequence Logic" unless instructions are given to the contrary, the modules are executed in the obvious
sequence. The sequence may be presented explicitly, by means of numbered steps, or implicitly, by the
order in which the modules are written.
"Selection Logic" employs a number of conditions, which lead to a selection of one out of several
alternative modules.
"Iteration Logic" refers to either of the two types of structures involving loops. Each type begins with a
Repeat statement and is followed by a module, called the body of the loop.
Algorithm Characteristics
Algorithm must satisfy the following criteria:
Input : These are zero or more quantities which are externally supplied.
Output : At least one quantity is produced.
For More Visit: Https://www.ThesisScientist.com
Definiteness : Each instruction must be clear and unambiguous.
Finiteness : If we trace out the instructions of an algorithm, then for all cases the algorithm must terminate
after a finite number of steps. A program does not satisfy this condition necessarily.
Example : Operating System.
Effectiveness : Every instruction must be sufficiently basic and also feasible.
Creating of Programs (Algorithm)
Program or Algorithm design is broken up into five phases :
 Requirements : Understanding the information given and what result is asked for.
 Design : Description of order of processing through a proper notation.
 Analysis : Refinement and Coding, Verification.
Algorithm Design Approaches
An algorithm consists of components, which have components of their own; indeed, and algorithm is a
hierarchy of components, the highest level components corresponding to the total algorithm.
To design such hierarchies there are two different possible approaches:
i. Top Down
ii. Bottom up
A Top Down design approach starts by identifying the major components of the system, decomposing them
into their lower level components, iterating until the desired level of details are achieved.
A Bottom up design approach starts with designing the most basic or primitive components that use these
lower level components.
For the bottom up approach to be successful, we must have a good notion of the top where the design
should be heading.
For detailed example see Unit-1.
Program Analysis
One goal of 'Data Structures' is to develop skills for making evaluating judgements about programs. There
are many criteria upon which we can judge a program, for instance.
 Does it do what we want it to do?
 Does it work correctly according to the original specifications of the task.
 Is there proper documentation, which describes how to use it and how it works.
 Are subroutines created in such a way that they perform logical subfunctions.
 Is the code readable.
For More Visit: Https://www.ThesisScientist.com
The above criteria are vitally important when it comes to writing software, most especially for large
systems.
Time and Space Complexity of Algorithms
The analysis of algorithms is a major task in Computer Science. In order to compare algorithms, we must
have some criteria to measure the efficiency of our algorithms.
The total time needed by any algorithm in execution and memory space required by the algorithm are the
two main measures for the efficiency of any algorithm.
To determine the execution time the following information is required:
 The Machine we are executing on.
 Its Machine language instruction set.
 The time required by each Machine instruction.
 The translation a compiler will make from the source to the Machine language.
But choosing a real machine and existing compiler even if hypothetical algorithms (with imaginary
executions times) is designed there would be the problem of compiler, which could vary from machine to
machine. All these considerations lead us to limit our goals.
Another approach is called the Frequency Count approach. In this approach the time is measured by
counting the number of key operations. Key operations of any algorithm are operations or steps which are
not to be excluded from the algorithm. We count only key operations because time for the other operations
is much less than or at the most proportional to the time for the key operations.
The space is measured by counting the maximum of memory needed by the algorithm.
Consider the following examples :
Example 1
Consider a program segment :
for(i=1; i<n; i++)
for(j=1; j<n; j++)
x++;
Frequency Count = n.n = n2
Order of complexity = 2
Array
For More Visit: Https://www.ThesisScientist.com
Linear Data Structures
A "data structure" which displays the relationship of adjacency between elements is said to be "linear".
This type of data structure is used to represent one of the simplest and most commonly found data object
i.e. ordered or linear list.
Examples are Months of the Year
[January, February, March.............., December]
or the values in a card deck.
[2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace]
or the group of friends
[Deepak, Narendra, Abhishek, Ashish, Saurabh].
If we consider anordered list more abstractly, we say that it is either empty or it can be written as
[x1, x2, x3......xn].
where xi's are atoms from some set A.
Operations on Linear Data Structures
There are a variety of operations that can be performed on these data structures. These operations include :
i) Find the length of the list, n;
ii) Read the list from left to right or (right to left).
iii) Retrieve the ith element, 1in.
iv) Store a new value into the ith position, 1in.
v) Insert a new element at position i, 1in causing elements numbered i, i+1......, n to become
numbered i+1, i+2....n+1;
vi) Delete the element at position i, 1in causing elements numbered i+1,...n to become numbered i,
i+1,....n-1.
Arrays
The simplest data structure that makes use of computed addresses to locate its elements is the One
Dimensional Array. Normally a number of (contiguous) memory locations are sequentially allocated to the
Array. Assuming that each element requires one word of memory, an n element Array will occupy n
consecutive words in memory. Array size is always fixed; and hence requires a fixed number of memory
locations.
Categorization
The arrays may be categorized in the following categories:
 One Dimensional Array
 Two Dimensional Arrays
 Three Dimensional Arrays
For More Visit: Https://www.ThesisScientist.com
 Multi Dimensional Arrays
Each type of Array has different kind of memory representation.
Memory Representation of One-Dimensional Array
A one dimensional array is a list of finite number n of Homogeneous data elements (i.e. data elements of
the same type) such that:
i) The elements of the Array are referenced respectively by an index set consisting of n consecutive
numbers.
ii) The elements of the Array are stored respectively in successive memory locations.
The number n of elements is called the length or size of the Array.
If not explicitly stated, we will assume the index set consists of the integers 1, 2, ...n. In general, the length
or the number of data elements of the Array can be obtained from the index set by the formula
Length = UB-LB+1________________________ (2.1)
where UB is the largest index, called the upper bound and LB is the smallest index, called the lower bound,
of the Array. Note that length = UB when LB=1.
The elements of an Array A may be denoted by the subscript notation A[1], A[2], A[3],... A[n].
In general a linear Array A with a subscript lower bound of "one" can be represented pictorially as in Fig.
3.1 given below.
.
.
.
A[I]
LB
Figure 3.1
If s words are allocated for each element or node (i.e. size of data types of elements of Array is s), then total
memory space allocated to array is given by :
Memory Space Request (UB-LB+1)*s___________________ (2.2)
If we want to calculate the memory space required for first i-1 elements of an Array then slight
modification in formula (2.2) will be needed. i.e.
Space Required = (i-1-LB+1)*s
or Space Required = (i-LB)*s_________________________(2.3)
If the Address of A[LB] is  then the Address of ith element of Array will be given by:
For More Visit: Https://www.ThesisScientist.com
Address of A[i] = +(i-LB)*s________________________(2.4)
Now, we can write a Program for addressing the ith element of a single dimensional Array. We can take , i,
LB and s as input from user and output the address of A[i].
Example 1
Consider a One-Dimensional Array of Fig. 3.2 given below. It has 5 elements. Each element takes 4 bytes
to store.
Suppose Address of a[0]=1000, and we want to calculate the address of a4 then from the formula (2.4) we
have,
 = 1000,
i = 4,
LB = 1,
s = 4
Address of a4 = 1000+(4-1)*4
Address of a4 = 1012.
a5
a4
a3
a2
a1
Figure 3.2
Memory Representation of Two Dimensional Arrays
Even though Multidimensional Arrays are provided as a standard data object in most of the high level
languages, it is interesting to see how they are represented in memory. Memory may be regarded as one
dimensional with words numbered from 1 to m. So we are concerned with representing n dimensional
Array in a one dimensional memory.
A two dimensional 'm x n' Array A is a collection of m.n data elements such that each element is specified
by a pair of integers (such as j, k), called subscripts, with property that
1jm and 1kn.
The element of A with first subscript j and second subscript k will be denoted by AJ,K or A[J, K]. Two
dimensional arrays are called matrices in mathematics and tables in Business Applications.
For More Visit: Https://www.ThesisScientist.com
Example 2
Columns
1 A [1, 1] A [1, 2] A [1, 3]
2 A [2, 1] A [2, 2] A [2, 3]
3 A [3, 1] A [3, 2] A [3, 3]
Two Dimensional 3x3 Array A
Programming language stores the array in either of the two way :
i) Row Major Order
ii) Column Major Order
In Row Major Order elements of 1st
Row are stored first in linear order and then comes elements of next
Row and so on.
In Column Major Order elements of 1st
column are stored first linearly and then comes elements of next
column. When Above Matrix is stored in memory using Row Major Order form then the representation will
be as shown below:
(1, 1)
(1, 2)
(1, 3)
(2, 1)
(2, 2)
(2, 3)
(3, 1)
(3, 2)
(3, 3)
Row 1
Row 2
Row 3
Figure 3.3
Representation with Column Major form will be:
For More Visit: Https://www.ThesisScientist.com
(1, 1)
(2, 1)
(3, 1)
(1, 2)
(2, 2)
(3, 2)
(1, 3)
(2, 3)
(3, 3)
Column 1
Column 2
Column 3
Figure 3.4
Number of elements in Any 2 Dimensional Array can be given by :
No. of elements = (UB1-LB1+1) * (UB2-LB2+1)_______________ (2.5)
where, UB1 is upper bound of 1st
dimension
LB1 is lower bound of 1st
dimension UB2 and LB2
are upper and lower bounds of 2nd
dimensions.
UB2
LB2
Row
LB1
UB1
ith
A[i, LB2
) …… A (I, j)
Figure 3.5
If we want to calculate the number of elements till Ist Row then.
No. of elements = (UB2-LB2+1) * (1-1+1)
Or No. of elements = UB2-LB2+1 _______________________(2.6)

Weitere ähnliche Inhalte

Was ist angesagt?

Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First SearchKevin Jadiya
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - GraphMadhu Bala
 
Principal of objected oriented programming
Principal of objected oriented programming Principal of objected oriented programming
Principal of objected oriented programming Rokonuzzaman Rony
 
Relational Algebra & Calculus
Relational Algebra & CalculusRelational Algebra & Calculus
Relational Algebra & CalculusAbdullah Khosa
 
Bubble sort
Bubble sortBubble sort
Bubble sortManek Ar
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Raj Naik
 
Sparse matrix and its representation data structure
Sparse matrix and its representation data structureSparse matrix and its representation data structure
Sparse matrix and its representation data structureVardhil Patel
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming ParadigmsDirecti Group
 
First order predicate logic(fopl)
First order predicate logic(fopl)First order predicate logic(fopl)
First order predicate logic(fopl)surbhi jha
 
Data types in python
Data types in pythonData types in python
Data types in pythonRaginiJain21
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational modelChirag vasava
 
Compiler design syntax analysis
Compiler design syntax analysisCompiler design syntax analysis
Compiler design syntax analysisRicha Sharma
 
Memory Management & Garbage Collection
Memory Management & Garbage CollectionMemory Management & Garbage Collection
Memory Management & Garbage CollectionAbhishek Sur
 

Was ist angesagt? (20)

Breadth First Search & Depth First Search
Breadth First Search & Depth First SearchBreadth First Search & Depth First Search
Breadth First Search & Depth First Search
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
 
Data structures using c
Data structures using cData structures using c
Data structures using c
 
Complexity of Algorithm
Complexity of AlgorithmComplexity of Algorithm
Complexity of Algorithm
 
Database language
Database languageDatabase language
Database language
 
Principal of objected oriented programming
Principal of objected oriented programming Principal of objected oriented programming
Principal of objected oriented programming
 
Data dictionary
Data dictionaryData dictionary
Data dictionary
 
Relational Algebra & Calculus
Relational Algebra & CalculusRelational Algebra & Calculus
Relational Algebra & Calculus
 
Data structure
Data structureData structure
Data structure
 
Bubble sort
Bubble sortBubble sort
Bubble sort
 
Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive Data Types - Premetive and Non Premetive
Data Types - Premetive and Non Premetive
 
Sparse matrix and its representation data structure
Sparse matrix and its representation data structureSparse matrix and its representation data structure
Sparse matrix and its representation data structure
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming Paradigms
 
First order predicate logic(fopl)
First order predicate logic(fopl)First order predicate logic(fopl)
First order predicate logic(fopl)
 
Data types in python
Data types in pythonData types in python
Data types in python
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Compiler design syntax analysis
Compiler design syntax analysisCompiler design syntax analysis
Compiler design syntax analysis
 
Relational model
Relational modelRelational model
Relational model
 
Memory Management & Garbage Collection
Memory Management & Garbage CollectionMemory Management & Garbage Collection
Memory Management & Garbage Collection
 

Ähnlich wie Introduction to Data Structure

Ähnlich wie Introduction to Data Structure (20)

Lect1.pptx
Lect1.pptxLect1.pptx
Lect1.pptx
 
Lec1
Lec1Lec1
Lec1
 
Lec1
Lec1Lec1
Lec1
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdf
 
Lecture 1 and 2
Lecture 1 and 2Lecture 1 and 2
Lecture 1 and 2
 
Chapter 1- IT.pptx
Chapter 1- IT.pptxChapter 1- IT.pptx
Chapter 1- IT.pptx
 
Introduction to Data Structure and algorithm.pptx
Introduction to Data Structure and algorithm.pptxIntroduction to Data Structure and algorithm.pptx
Introduction to Data Structure and algorithm.pptx
 
Chapter 1 Data structure.pptx
Chapter 1 Data structure.pptxChapter 1 Data structure.pptx
Chapter 1 Data structure.pptx
 
Chapter 01
Chapter 01Chapter 01
Chapter 01
 
Ch08
Ch08Ch08
Ch08
 
Ch08
Ch08Ch08
Ch08
 
Lec1
Lec1Lec1
Lec1
 
CORRELATING FEATURES AND CODE BY DYNAMIC AND SEMANTIC ANALYSIS
CORRELATING FEATURES AND CODE BY DYNAMIC AND SEMANTIC ANALYSISCORRELATING FEATURES AND CODE BY DYNAMIC AND SEMANTIC ANALYSIS
CORRELATING FEATURES AND CODE BY DYNAMIC AND SEMANTIC ANALYSIS
 
8.unit-1-fds-2022-23.pptx
8.unit-1-fds-2022-23.pptx8.unit-1-fds-2022-23.pptx
8.unit-1-fds-2022-23.pptx
 
Unit 1 dsa
Unit 1 dsaUnit 1 dsa
Unit 1 dsa
 
Introduction to Data structure and algorithm.pptx
Introduction to Data structure and algorithm.pptxIntroduction to Data structure and algorithm.pptx
Introduction to Data structure and algorithm.pptx
 
Sdlc
SdlcSdlc
Sdlc
 
Sdlc
SdlcSdlc
Sdlc
 
DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS
 
C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]C++ [ principles of object oriented programming ]
C++ [ principles of object oriented programming ]
 

Mehr von Prof Ansari

Sci Hub New Domain
Sci Hub New DomainSci Hub New Domain
Sci Hub New DomainProf Ansari
 
Sci Hub cc Not Working
Sci Hub cc Not WorkingSci Hub cc Not Working
Sci Hub cc Not WorkingProf Ansari
 
basics of computer network
basics of computer networkbasics of computer network
basics of computer networkProf Ansari
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTIONProf Ansari
 
Project Evaluation and Estimation in Software Development
Project Evaluation and Estimation in Software DevelopmentProject Evaluation and Estimation in Software Development
Project Evaluation and Estimation in Software DevelopmentProf Ansari
 
Stepwise Project planning in software development
Stepwise Project planning in software developmentStepwise Project planning in software development
Stepwise Project planning in software developmentProf Ansari
 
Database and Math Relations
Database and Math RelationsDatabase and Math Relations
Database and Math RelationsProf Ansari
 
Normalisation in Database management System (DBMS)
Normalisation in Database management System (DBMS)Normalisation in Database management System (DBMS)
Normalisation in Database management System (DBMS)Prof Ansari
 
Entity-Relationship Data Model in DBMS
Entity-Relationship Data Model in DBMSEntity-Relationship Data Model in DBMS
Entity-Relationship Data Model in DBMSProf Ansari
 
A Detail Database Architecture
A Detail Database ArchitectureA Detail Database Architecture
A Detail Database ArchitectureProf Ansari
 
INTRODUCTION TO Database Management System (DBMS)
INTRODUCTION TO Database Management System (DBMS)INTRODUCTION TO Database Management System (DBMS)
INTRODUCTION TO Database Management System (DBMS)Prof Ansari
 
Master thesis on Vehicular Ad hoc Networks (VANET)
Master thesis on Vehicular Ad hoc Networks (VANET)Master thesis on Vehicular Ad hoc Networks (VANET)
Master thesis on Vehicular Ad hoc Networks (VANET)Prof Ansari
 
Master Thesis on Vehicular Ad-hoc Network (VANET)
Master Thesis on Vehicular Ad-hoc Network (VANET)Master Thesis on Vehicular Ad-hoc Network (VANET)
Master Thesis on Vehicular Ad-hoc Network (VANET)Prof Ansari
 
INTERFACING WITH INTEL 8251A (USART)
INTERFACING WITH INTEL 8251A (USART)INTERFACING WITH INTEL 8251A (USART)
INTERFACING WITH INTEL 8251A (USART)Prof Ansari
 
HOST AND NETWORK SECURITY by ThesisScientist.com
HOST AND NETWORK SECURITY by ThesisScientist.comHOST AND NETWORK SECURITY by ThesisScientist.com
HOST AND NETWORK SECURITY by ThesisScientist.comProf Ansari
 
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPSSYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPSProf Ansari
 
INTRODUCTION TO VISUAL BASICS
INTRODUCTION TO VISUAL BASICS INTRODUCTION TO VISUAL BASICS
INTRODUCTION TO VISUAL BASICS Prof Ansari
 
introduction to Blogging ppt
introduction to Blogging pptintroduction to Blogging ppt
introduction to Blogging pptProf Ansari
 
INTRODUCTION TO SOFTWARE ENGINEERING
INTRODUCTION TO SOFTWARE ENGINEERINGINTRODUCTION TO SOFTWARE ENGINEERING
INTRODUCTION TO SOFTWARE ENGINEERINGProf Ansari
 
Introduction to E-commerce
Introduction to E-commerceIntroduction to E-commerce
Introduction to E-commerceProf Ansari
 

Mehr von Prof Ansari (20)

Sci Hub New Domain
Sci Hub New DomainSci Hub New Domain
Sci Hub New Domain
 
Sci Hub cc Not Working
Sci Hub cc Not WorkingSci Hub cc Not Working
Sci Hub cc Not Working
 
basics of computer network
basics of computer networkbasics of computer network
basics of computer network
 
JAVA INTRODUCTION
JAVA INTRODUCTIONJAVA INTRODUCTION
JAVA INTRODUCTION
 
Project Evaluation and Estimation in Software Development
Project Evaluation and Estimation in Software DevelopmentProject Evaluation and Estimation in Software Development
Project Evaluation and Estimation in Software Development
 
Stepwise Project planning in software development
Stepwise Project planning in software developmentStepwise Project planning in software development
Stepwise Project planning in software development
 
Database and Math Relations
Database and Math RelationsDatabase and Math Relations
Database and Math Relations
 
Normalisation in Database management System (DBMS)
Normalisation in Database management System (DBMS)Normalisation in Database management System (DBMS)
Normalisation in Database management System (DBMS)
 
Entity-Relationship Data Model in DBMS
Entity-Relationship Data Model in DBMSEntity-Relationship Data Model in DBMS
Entity-Relationship Data Model in DBMS
 
A Detail Database Architecture
A Detail Database ArchitectureA Detail Database Architecture
A Detail Database Architecture
 
INTRODUCTION TO Database Management System (DBMS)
INTRODUCTION TO Database Management System (DBMS)INTRODUCTION TO Database Management System (DBMS)
INTRODUCTION TO Database Management System (DBMS)
 
Master thesis on Vehicular Ad hoc Networks (VANET)
Master thesis on Vehicular Ad hoc Networks (VANET)Master thesis on Vehicular Ad hoc Networks (VANET)
Master thesis on Vehicular Ad hoc Networks (VANET)
 
Master Thesis on Vehicular Ad-hoc Network (VANET)
Master Thesis on Vehicular Ad-hoc Network (VANET)Master Thesis on Vehicular Ad-hoc Network (VANET)
Master Thesis on Vehicular Ad-hoc Network (VANET)
 
INTERFACING WITH INTEL 8251A (USART)
INTERFACING WITH INTEL 8251A (USART)INTERFACING WITH INTEL 8251A (USART)
INTERFACING WITH INTEL 8251A (USART)
 
HOST AND NETWORK SECURITY by ThesisScientist.com
HOST AND NETWORK SECURITY by ThesisScientist.comHOST AND NETWORK SECURITY by ThesisScientist.com
HOST AND NETWORK SECURITY by ThesisScientist.com
 
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPSSYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
SYSTEM NETWORK ADMINISTRATIONS GOALS and TIPS
 
INTRODUCTION TO VISUAL BASICS
INTRODUCTION TO VISUAL BASICS INTRODUCTION TO VISUAL BASICS
INTRODUCTION TO VISUAL BASICS
 
introduction to Blogging ppt
introduction to Blogging pptintroduction to Blogging ppt
introduction to Blogging ppt
 
INTRODUCTION TO SOFTWARE ENGINEERING
INTRODUCTION TO SOFTWARE ENGINEERINGINTRODUCTION TO SOFTWARE ENGINEERING
INTRODUCTION TO SOFTWARE ENGINEERING
 
Introduction to E-commerce
Introduction to E-commerceIntroduction to E-commerce
Introduction to E-commerce
 

Kürzlich hochgeladen

PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEselvakumar948
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityMorshed Ahmed Rahath
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilVinayVitekari
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 

Kürzlich hochgeladen (20)

PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLEGEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
GEAR TRAIN- BASIC CONCEPTS AND WORKING PRINCIPLE
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 

Introduction to Data Structure

  • 1. For More Visit: Https://www.ThesisScientist.com Unit 2 Introduction to Data Structure Introduction A computer is a machine that manipulates information. The study of Computer Science includes the study of how information is organized in a Computer, how it can be manipulated and how it can be utilized. Thus, it is exceedingly important to understand the concept of information organization and manipulation. Computer Science can be defined as the study of the data, its representation and transformation by a digital computer. Data Structure Data may be organized in many different ways; the logical or mathematical model of a particular organization of data is called "Data Structure". The choice of a particular data model depends on two considerations:  It must be rich enough in structure to reflect the actual relationships of the data in the real world.  The structure should be simple enough that one can effectively process the data when necessary. Data Structure Operations The particular data structure that one chooses for a given situation depends largely on the nature of specific operations to be performed. The following are the four major operations associated with any data structure: i. Traversing : Accessing each record exactly once so that certain items in the record may be processed. ii. Searching : Finding the location of the record with a given key value, or finding the locations of all records which satisfy one or more conditions. iii. Inserting : Adding a new record to the structure. iv. Deleting : Removing a record from the structure. Primitive and Composite Data Types Primitive Data Types are Basic data types of any language. In most computers these are native to the machine's hardware. Some Primitive data types are:  Integer
  • 2. For More Visit: Https://www.ThesisScientist.com  Character  Real Number  Logical Number  Pointers Integer A quantity representing objects that are discrete in nature can be represented by an integer. Ex. 2, 0, -56, 89998 etc. are integers Ex. 34.89, -3.98, abc, uii*^lkd889 are not integers Character Information is not always interpreted numerically. Items such as names, job, addresses etc. must also be represented in some fashion within a computer. Character is a literal expression of some element selected from an alphabet. A wide variety of character sets (or alphabets) are handled by the most popular computers. Two of the largest and most widely used character sets are represented by EBDIC and ASCII. Ex. „A‟, „b‟, „/‟, „*‟, ‟5‟ etc. are characters Ex. 23, 45.5, “AJHJHA”, 7&^&* are not characters Real Number The usual method used by computers to represent real numbers is floating-point notation. There are many varieties of floating point notation and each has individual characteristics. The key concept is that a real number is represented by a number, called a mantissa, times a base raised to an integer power called an exponent. The base is usually fixed, and the mantissa and exponent vary to represent different real numbers. Example : If the base is fixed at 10, the number 485.43 can be represented as 48543×10-2 . Logical Number A logical data item is a primitive data type that can assume the values of either TRUE or FALSE. Pointers A pointer is a reference to a data structure. As pointer is a single fixed-size data item, it provides a homogeneous method of referencing any data structure, regardless of the structure's type or complexity. In some instance the pointers permit faster insertion and deletion of elements to and from a data structure. Int x; Here x is an integer type while p is a pointer to integer type. Int *p;
  • 3. For More Visit: Https://www.ThesisScientist.com Abstract Data Type A tool that permits a designer to consider a component at an abstract level, without worrying about the details of its implementation is called ABSTRACTION. Treating the data as objects with some predefined operations that can be performed on those objects is called Data Abstraction. Data Abstraction when supported as a data types in a language is called Abstract Data Type (ADT). ADT is a useful tool for specifying the logical properties of a data type. The term "Abstract Data Type" refers to the basic mathematical concept that defines the data type. Ex. Integer is an abstraction of a numerical quantity which is a whole number and can be positive or negative. Ex. Point is an abstraction of a two dimensional figure having no length and breadth. Atomic Type It is a value (constant or variable), which is treated as single entity only and cannot be subdivided. Integers, reals, characters type of data cannot be broken further into any simpler data types, therefore, these are atomic type. Whereas, name of a person is not an atomic type data, because it can be broken into first name and last name. Also, first and last names can be further broken into character type. Structured Type It is a set of values, which has two ingredients: i) It is made up of COMPONENT elements. ii) There is a structure, i.e. a set of rules for putting the components together. Ex. Address is a structured type data : it has components – house No., Street No., City etc. Ex. Date of birth is a structured data : it has day, moth and year data items. Refinement Stages Stages from any mathematical concept to its implementation as application are as follows: Example 1
  • 4. For More Visit: Https://www.ThesisScientist.com Any Sequence Queue Linear Circular Array With Counter Array With Flag Airport Simulation Introduction to Algorithm Design Algorithm An algorithm is a well-defined list of steps for solving a particular problem. In other words an algorithm is a finite step by step list of well-defined instructions for solving a particular problem. The steps of the algorithm are executed one after the other, beginning with step 1. Algorithms and their equivalent computer programs are more easily understood if they mainly use self- contained modules and three types of logic, or flow of control called 1. Sequence Logic or Sequential Logic 2. Selection or Conditional Logic 3. Iteration or Repetitive Logic In "Sequence Logic" unless instructions are given to the contrary, the modules are executed in the obvious sequence. The sequence may be presented explicitly, by means of numbered steps, or implicitly, by the order in which the modules are written. "Selection Logic" employs a number of conditions, which lead to a selection of one out of several alternative modules. "Iteration Logic" refers to either of the two types of structures involving loops. Each type begins with a Repeat statement and is followed by a module, called the body of the loop. Algorithm Characteristics Algorithm must satisfy the following criteria: Input : These are zero or more quantities which are externally supplied. Output : At least one quantity is produced.
  • 5. For More Visit: Https://www.ThesisScientist.com Definiteness : Each instruction must be clear and unambiguous. Finiteness : If we trace out the instructions of an algorithm, then for all cases the algorithm must terminate after a finite number of steps. A program does not satisfy this condition necessarily. Example : Operating System. Effectiveness : Every instruction must be sufficiently basic and also feasible. Creating of Programs (Algorithm) Program or Algorithm design is broken up into five phases :  Requirements : Understanding the information given and what result is asked for.  Design : Description of order of processing through a proper notation.  Analysis : Refinement and Coding, Verification. Algorithm Design Approaches An algorithm consists of components, which have components of their own; indeed, and algorithm is a hierarchy of components, the highest level components corresponding to the total algorithm. To design such hierarchies there are two different possible approaches: i. Top Down ii. Bottom up A Top Down design approach starts by identifying the major components of the system, decomposing them into their lower level components, iterating until the desired level of details are achieved. A Bottom up design approach starts with designing the most basic or primitive components that use these lower level components. For the bottom up approach to be successful, we must have a good notion of the top where the design should be heading. For detailed example see Unit-1. Program Analysis One goal of 'Data Structures' is to develop skills for making evaluating judgements about programs. There are many criteria upon which we can judge a program, for instance.  Does it do what we want it to do?  Does it work correctly according to the original specifications of the task.  Is there proper documentation, which describes how to use it and how it works.  Are subroutines created in such a way that they perform logical subfunctions.  Is the code readable.
  • 6. For More Visit: Https://www.ThesisScientist.com The above criteria are vitally important when it comes to writing software, most especially for large systems. Time and Space Complexity of Algorithms The analysis of algorithms is a major task in Computer Science. In order to compare algorithms, we must have some criteria to measure the efficiency of our algorithms. The total time needed by any algorithm in execution and memory space required by the algorithm are the two main measures for the efficiency of any algorithm. To determine the execution time the following information is required:  The Machine we are executing on.  Its Machine language instruction set.  The time required by each Machine instruction.  The translation a compiler will make from the source to the Machine language. But choosing a real machine and existing compiler even if hypothetical algorithms (with imaginary executions times) is designed there would be the problem of compiler, which could vary from machine to machine. All these considerations lead us to limit our goals. Another approach is called the Frequency Count approach. In this approach the time is measured by counting the number of key operations. Key operations of any algorithm are operations or steps which are not to be excluded from the algorithm. We count only key operations because time for the other operations is much less than or at the most proportional to the time for the key operations. The space is measured by counting the maximum of memory needed by the algorithm. Consider the following examples : Example 1 Consider a program segment : for(i=1; i<n; i++) for(j=1; j<n; j++) x++; Frequency Count = n.n = n2 Order of complexity = 2 Array
  • 7. For More Visit: Https://www.ThesisScientist.com Linear Data Structures A "data structure" which displays the relationship of adjacency between elements is said to be "linear". This type of data structure is used to represent one of the simplest and most commonly found data object i.e. ordered or linear list. Examples are Months of the Year [January, February, March.............., December] or the values in a card deck. [2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace] or the group of friends [Deepak, Narendra, Abhishek, Ashish, Saurabh]. If we consider anordered list more abstractly, we say that it is either empty or it can be written as [x1, x2, x3......xn]. where xi's are atoms from some set A. Operations on Linear Data Structures There are a variety of operations that can be performed on these data structures. These operations include : i) Find the length of the list, n; ii) Read the list from left to right or (right to left). iii) Retrieve the ith element, 1in. iv) Store a new value into the ith position, 1in. v) Insert a new element at position i, 1in causing elements numbered i, i+1......, n to become numbered i+1, i+2....n+1; vi) Delete the element at position i, 1in causing elements numbered i+1,...n to become numbered i, i+1,....n-1. Arrays The simplest data structure that makes use of computed addresses to locate its elements is the One Dimensional Array. Normally a number of (contiguous) memory locations are sequentially allocated to the Array. Assuming that each element requires one word of memory, an n element Array will occupy n consecutive words in memory. Array size is always fixed; and hence requires a fixed number of memory locations. Categorization The arrays may be categorized in the following categories:  One Dimensional Array  Two Dimensional Arrays  Three Dimensional Arrays
  • 8. For More Visit: Https://www.ThesisScientist.com  Multi Dimensional Arrays Each type of Array has different kind of memory representation. Memory Representation of One-Dimensional Array A one dimensional array is a list of finite number n of Homogeneous data elements (i.e. data elements of the same type) such that: i) The elements of the Array are referenced respectively by an index set consisting of n consecutive numbers. ii) The elements of the Array are stored respectively in successive memory locations. The number n of elements is called the length or size of the Array. If not explicitly stated, we will assume the index set consists of the integers 1, 2, ...n. In general, the length or the number of data elements of the Array can be obtained from the index set by the formula Length = UB-LB+1________________________ (2.1) where UB is the largest index, called the upper bound and LB is the smallest index, called the lower bound, of the Array. Note that length = UB when LB=1. The elements of an Array A may be denoted by the subscript notation A[1], A[2], A[3],... A[n]. In general a linear Array A with a subscript lower bound of "one" can be represented pictorially as in Fig. 3.1 given below. . . . A[I] LB Figure 3.1 If s words are allocated for each element or node (i.e. size of data types of elements of Array is s), then total memory space allocated to array is given by : Memory Space Request (UB-LB+1)*s___________________ (2.2) If we want to calculate the memory space required for first i-1 elements of an Array then slight modification in formula (2.2) will be needed. i.e. Space Required = (i-1-LB+1)*s or Space Required = (i-LB)*s_________________________(2.3) If the Address of A[LB] is  then the Address of ith element of Array will be given by:
  • 9. For More Visit: Https://www.ThesisScientist.com Address of A[i] = +(i-LB)*s________________________(2.4) Now, we can write a Program for addressing the ith element of a single dimensional Array. We can take , i, LB and s as input from user and output the address of A[i]. Example 1 Consider a One-Dimensional Array of Fig. 3.2 given below. It has 5 elements. Each element takes 4 bytes to store. Suppose Address of a[0]=1000, and we want to calculate the address of a4 then from the formula (2.4) we have,  = 1000, i = 4, LB = 1, s = 4 Address of a4 = 1000+(4-1)*4 Address of a4 = 1012. a5 a4 a3 a2 a1 Figure 3.2 Memory Representation of Two Dimensional Arrays Even though Multidimensional Arrays are provided as a standard data object in most of the high level languages, it is interesting to see how they are represented in memory. Memory may be regarded as one dimensional with words numbered from 1 to m. So we are concerned with representing n dimensional Array in a one dimensional memory. A two dimensional 'm x n' Array A is a collection of m.n data elements such that each element is specified by a pair of integers (such as j, k), called subscripts, with property that 1jm and 1kn. The element of A with first subscript j and second subscript k will be denoted by AJ,K or A[J, K]. Two dimensional arrays are called matrices in mathematics and tables in Business Applications.
  • 10. For More Visit: Https://www.ThesisScientist.com Example 2 Columns 1 A [1, 1] A [1, 2] A [1, 3] 2 A [2, 1] A [2, 2] A [2, 3] 3 A [3, 1] A [3, 2] A [3, 3] Two Dimensional 3x3 Array A Programming language stores the array in either of the two way : i) Row Major Order ii) Column Major Order In Row Major Order elements of 1st Row are stored first in linear order and then comes elements of next Row and so on. In Column Major Order elements of 1st column are stored first linearly and then comes elements of next column. When Above Matrix is stored in memory using Row Major Order form then the representation will be as shown below: (1, 1) (1, 2) (1, 3) (2, 1) (2, 2) (2, 3) (3, 1) (3, 2) (3, 3) Row 1 Row 2 Row 3 Figure 3.3 Representation with Column Major form will be:
  • 11. For More Visit: Https://www.ThesisScientist.com (1, 1) (2, 1) (3, 1) (1, 2) (2, 2) (3, 2) (1, 3) (2, 3) (3, 3) Column 1 Column 2 Column 3 Figure 3.4 Number of elements in Any 2 Dimensional Array can be given by : No. of elements = (UB1-LB1+1) * (UB2-LB2+1)_______________ (2.5) where, UB1 is upper bound of 1st dimension LB1 is lower bound of 1st dimension UB2 and LB2 are upper and lower bounds of 2nd dimensions. UB2 LB2 Row LB1 UB1 ith A[i, LB2 ) …… A (I, j) Figure 3.5 If we want to calculate the number of elements till Ist Row then. No. of elements = (UB2-LB2+1) * (1-1+1) Or No. of elements = UB2-LB2+1 _______________________(2.6)