SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
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)

Contenu connexe

Tendances

Tendances (20)

Data mining techniques unit 1
Data mining techniques  unit 1Data mining techniques  unit 1
Data mining techniques unit 1
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
standard template library(STL) in C++
standard template library(STL) in C++standard template library(STL) in C++
standard template library(STL) in C++
 
linked list
linked list linked list
linked list
 
Pandas
PandasPandas
Pandas
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
Linear search-and-binary-search
Linear search-and-binary-searchLinear search-and-binary-search
Linear search-and-binary-search
 
C++ Arrays
C++ ArraysC++ Arrays
C++ Arrays
 
Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
 
Introduction to data structure ppt
Introduction to data structure pptIntroduction to data structure ppt
Introduction to data structure ppt
 
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 Data Structures - Lecture 9 [Stack & Queue using Linked List] Data Structures - Lecture 9 [Stack & Queue using Linked List]
Data Structures - Lecture 9 [Stack & Queue using Linked List]
 
Data Models
Data ModelsData Models
Data Models
 
Data Structure
Data Structure Data Structure
Data Structure
 
Database, Lecture-1.ppt
Database, Lecture-1.pptDatabase, Lecture-1.ppt
Database, Lecture-1.ppt
 
Elementary data organisation
Elementary data organisationElementary data organisation
Elementary data organisation
 
Introduction to numpy
Introduction to numpyIntroduction to numpy
Introduction to numpy
 
Data types
Data typesData types
Data types
 
Data structures & algorithms lecture 3
Data structures & algorithms lecture 3Data structures & algorithms lecture 3
Data structures & algorithms lecture 3
 

Similaire à Introduction to Data Structure

Similaire à 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 ]
 

Plus de 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
 

Plus de 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
 

Dernier

Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
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
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projectssmsksolar
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoordharasingh5698
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf203318pmpc
 
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
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 

Dernier (20)

Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
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
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects2016EF22_0 solar project report rooftop projects
2016EF22_0 solar project report rooftop projects
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf
 
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
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 

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)