Array data structure all about arrays vectors and space and time complexity and questions how STL works how loops used in arrays C++,Java how vectors data structure used
Arrays are ordered sets of elements of the same type that allow direct access to each element through an index. In C++, arrays have a fixed size that is declared, with elements accessed using square brackets and integers representing their position. Multidimensional arrays arrange data in tables and can be thought of as arrays of arrays. Elements are accessed using multiple indices separated by commas within the brackets.
This document provides an overview of arrays and linked lists as data structures. It discusses arrays, including declaration, initialization, updating elements, and multi-dimensional arrays. It also covers searching arrays, why arrays are needed, pros and cons of arrays, and character strings as arrays. The document then introduces linked lists as a data structure and discusses linked list operations like printing all elements, adding nodes, appending nodes, inserting nodes, and deleting nodes. Homework questions on arrays and linked lists are provided at the end.
C programming language provides arrays as a data structure to store a fixed-size collection of elements of the same type. An array stores elements in contiguous memory locations. Individual elements in an array can be accessed using an index. Common array operations in C include declaration, initialization, accessing and modifying individual elements, and passing arrays to functions.
An array is a group of data items of same data type that share a common name. Ordinary variables are capable of holding only one value at a time. If we want to store more than one value at a time in a single variable, we use arrays.
An array is a collective name given to a group of similar variables. Each member in the group is referred to by its position in the group.
Arrays are alloted the memory in a strictly contiguous fashion. The simplest array is a one-dimensional array which is a list of variables of same data type. An array of one-dimensional arrays is called a two-dimensional array.
Homework Assignment – Array Technical DocumentWrite a technical .pdfaroraopticals15
Homework Assignment – Array Technical Document
Write a technical document that describes the structure and use of arrays. The document should
be 3 to 5 pages and include an Introduction section, giving a brief synopsis of the document and
arrays, a Body section, describing arrays and giving an annotated example of their use as a
programming construct, and a conclusion to revisit important information about arrays described
in the Body of the document. Some suggested material to include:
Declaring arrays of various types
Array pointers
Printing and processing arrays
Sorting and searching arrays
Multidimensional arrays
Indexing arrays of various dimension
Array representation in memory by data type
Passing arrays as arguments
If you find any useful images on the Internet, you can use them as long as you cite the source in
end notes.
Solution
Array is a collection of variables of the same type that are referenced by a common name.
Specific elements or variables in the array are accessed by means of index into the array.
If taking about C, In C all arrays consist of contiguous memory locations. The lowest address
corresponds to the first element in the array while the largest address corresponds to the last
element in the array.
C supports both single and multi-dimensional arrays.
1) Single Dimension Arrays:-
Syntax:- type var_name[size];
where type is the type of each element in the array, var_name is any valid identifier, and size is
the number of elements in the array which has to be a constant value.
*Array always use zero as index to first element.
The valid indices for array above are 0 .. 4, i.e. 0 .. number of elements - 1
For Example :- To load an array with values 0 .. 99
int x[100] ;
int i ;
for ( i = 0; i < 100; i++ )
x[i] = i ;
To determine to size of an array at run time the sizeof operator is used. This returns the size in
bytes of its argument. The name of the array is given as the operand
size_of_array = sizeof ( array_name ) ;
2) Initialisg array:-
Arrays can be initialised at time of declaration in the following manner.
type array[ size ] = { value list };
For Example :-
int i[5] = {1, 2, 3, 4, 5 } ;
i[0] = 1, i[1] = 2, etc.
The size specification in the declaration may be omitted which causes the compiler to count the
number of elements in the value list and allocate appropriate storage.
For Example :- int i[ ] = { 1, 2, 3, 4, 5 } ;
3) Multidimensional array:-
Multidimensional arrays of any dimension are possible in C but in practice only two or three
dimensional arrays are workable. The most common multidimensional array is a two
dimensional array for example the computer display, board games, a mathematical matrix etc.
Syntax :type name [ rows ] [ columns ] ;
For Example :- 2D array of dimension 2 X 3.
int d[ 2 ] [ 3 ] ;
A two dimensional array is actually an array of arrays, in the above case an array of two integer
arrays (the rows) each with three elements, and is stored row-wise in memory.
For Example :- Program to fill .
Arrays allow storing multiple values of the same type under one common name. They come in one-dimensional and two-dimensional forms. One-dimensional arrays store elements indexed with a single subscript, while two-dimensional arrays represent matrices with rows and columns indexed by two subscripts. Arrays can be passed to functions by passing their name and size for numeric arrays, or just the name for character/string arrays since strings are null-terminated. Functions can operate on arrays to perform tasks like finding the highest/lowest element or reversing a string.
The document discusses one-dimensional and two-dimensional arrays in C++. It defines an array as a series of elements of the same type that allows storing multiple values of that type. For one-dimensional arrays, it covers declaring, initializing, and accessing arrays using indexes. Two-dimensional arrays are defined as arrays of arrays, representing a table with rows and columns where each element is accessed using row and column indexes. The document provides examples of declaring, initializing, and accessing elements in one-dimensional and two-dimensional arrays in C++.
C programming language allows for the declaration of arrays, which can store a fixed number of elements of the same data type. Arrays provide an efficient way to store and access related data sequentially in memory. Individual elements in an array are accessed via an index, and multi-dimensional arrays can model tables of data with multiple indices to access each element.
This document discusses one-dimensional and two-dimensional arrays in C. It covers array initialization, passing arrays to functions, and common errors. Key topics include declaring and initializing one-dimensional arrays, accessing array elements using indexes, initializing two-dimensional arrays in row-major order, and calculating the memory location of elements in two-dimensional arrays based on row and column indexes. Examples are provided to demonstrate computing averages and standard deviations of arrays.
1. Arrays allow storing a collection of related data items and can be one-dimensional or multidimensional.
2. Two-dimensional arrays are arrays of one-dimensional arrays with two indices to access elements.
3. Preprocessor directives like #include and #define are instructions to the compiler and are not part of the C language itself. They expand the scope of the programming environment.
Arrays & Strings can be summarized as follows:
1. Arrays are fixed-size collections of elements of the same data type that are used to store lists of related data. They can be one-dimensional, two-dimensional, or multi-dimensional.
2. Strings in C are arrays of characters terminated by a null character. They are commonly used to store text data. Common string operations include reading, writing, combining, copying, comparing, and extracting portions of strings.
3. Arrays are declared with a data type, name, and size. They can be initialized with a block of comma-separated values. Individual elements are accessed using indexes in square brackets. Two-dimensional arrays represent tables
1. An array is an object that stores a list of values of the same type and is made up of contiguous memory divided into slots indexed from 0 to N-1.
2. One-dimensional arrays use a single subscript to access elements, while two-dimensional and higher dimensional arrays use multiple subscripts to represent rows and columns.
3. Arrays are declared with the syntax Type[] name = new Type[size]; and elements can be accessed using name[index].
The Array is the most commonly used Data Structure.
An array is a collection of data elements that are of the same type (e.g., a collection of integers, collection of characters, collection of doubles).
OR
Array is a data structure that represents a collection of the same types of data.
The values held in an array are called array elements
An array stores multiple values of the same type – the element type
The element type can be a primitive type or an object reference
Therefore, we can create an array of integers, an array of characters, an array of String objects, an array of Coin objects, etc.
The document discusses C arrays and multi-dimensional arrays. It defines arrays as a collection of related data items represented by a single variable name. Arrays must be declared before use with the general form of "type variablename[size]". Elements are accessed via indexes from 0 to size-1. The document also discusses initializing arrays, multi-dimensional arrays with two or more subscripts to represent rows and columns, and provides examples of declaring and initializing multi-dimensional arrays in C.
Arrays are a commonly used data structure that store multiple elements of the same type. Elements in an array are accessed using subscripts or indexes, with the first element having an index of 0. Multidimensional arrays can store elements in rows and columns, accessed using two indexes. Arrays are stored linearly in memory in either row-major or column-major order, which affects how elements are accessed.
An array is a collection of similar elements that are stored in contiguous memory locations. Arrays in C can have one or more dimensions. One-dimensional arrays are declared with the type of elements, name of the array, and number of elements within brackets (e.g. int marks[30]). Multi-dimensional arrays represent matrices and are declared with the number of rows and columns (e.g. int arr[5][10]). Individual elements within an array are accessed via indices (e.g. arr[2][7]). Pointers in C are related to arrays - the name of an array represents the address of its first element, and pointer arithmetic can be used to access successive elements in an array.
The document discusses strings, arrays, pointers, and sorting algorithms in C programming. It provides definitions and examples of:
1) Strings as null-terminated character arrays. It demonstrates initializing and printing a string.
2) One-dimensional and two-dimensional arrays. It shows how to declare, initialize, access, and print multi-dimensional arrays.
3) Pointers as variables that store memory addresses. It explains pointer declaration and dereferencing pointers using asterisk (*) operator.
4) Bubble sort algorithm that iterates through an array and swaps adjacent elements if out of order, putting largest elements at the end of the array in each iteration.
The document discusses arrays in C programming language. It defines arrays as fixed-sized sequenced collections of elements of the same data type that share a common name. One-dimensional arrays represent lists, while two-dimensional arrays represent tables with rows and columns. Arrays must be declared before use with the size specified. Elements can be accessed using indices and initialized. Common operations like input, output, sorting and searching of array elements are demonstrated through examples.
● Introduction to Arrays
● Declaration and initialization of one dimensional and two-dimensional
arrays.
● Definition and initialization of String
● String functions
An array is a contiguous block of memory that stores elements of the same data type. Arrays allow storing and accessing related data collectively under a single name. An array is declared with a data type, name, and size. Elements are accessed via indexes that range from 0 to size-1. Common array operations include initialization, accessing elements using loops, input/output, and finding highest/lowest values. Arrays can be single-dimensional or multi-dimensional. Multi-dimensional arrays represent matrices and elements are accessed using multiple indexes. Common array applications include storing student marks, employee salaries, and matrix operations.
Here is a C program that multiplies two matrices using 2D arrays:
#include <stdio.h>
int main() {
int a[2][2], b[2][2], product[2][2], i, j, k;
printf("Enter elements of first matrix:\n");
for(i=0; i<2; i++)
for(j=0; j<2; j++)
scanf("%d", &a[i][j]);
printf("Enter elements of second matrix:\n");
for(i=0; i<2; i++)
for(j=0; j<2; j++)
scanf("%d", &
Array
Introduction
One-dimensional array
Multidimensional array
Advantage of Array
Write a C program using arrays that produces the multiplication of two matrices.
2D array in C++ language ,define the concept of c++ Two-Dimensional array .with example .and also Accessing Array Components concept.and Processing Two-Dimensional Arrays.
The document discusses one-dimensional arrays in C++. It defines an array as a series of elements of the same type that can be referenced collectively by a common name. These elements are placed in consecutive memory locations and can be individually referenced using a subscript or index. The document covers declaring and initializing one-dimensional arrays, accessing array elements individually and collectively, inputting and displaying array elements, and provides examples of programs that work with arrays.
This document provides an overview of nullables, arrays, and strings in C#. It discusses how C# provides nullable types to allow variables to be assigned null values. It also explains that arrays store a fixed-size collection of elements of the same type and how to declare, initialize, and access array elements. Additionally, it covers multidimensional arrays, jagged arrays, passing arrays as function arguments, and methods of the Array class.
This document discusses arrays in C programming. It begins by defining arrays as fixed-size sequenced collections of related data items that share a common name. It then covers key topics such as declaring and initializing one-dimensional and multi-dimensional arrays, searching and sorting techniques for arrays, and common programming errors related to arrays. Examples are provided to demonstrate array concepts like initialization, indexing, and algorithms for operations like matrix addition.
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schoolsdogden2
Algebra 1 is often described as a “gateway” class, a pivotal moment that can shape the rest of a student’s K–12 education. Early access is key: successfully completing Algebra 1 in middle school allows students to complete advanced math and science coursework in high school, which research shows lead to higher wages and lower rates of unemployment in adulthood.
Learn how The Atlanta Public Schools is using their data to create a more equitable enrollment in middle school Algebra classes.
Ad
More Related Content
Similar to Arrays and vectors in Data Structure.ppt (20)
This document discusses one-dimensional and two-dimensional arrays in C. It covers array initialization, passing arrays to functions, and common errors. Key topics include declaring and initializing one-dimensional arrays, accessing array elements using indexes, initializing two-dimensional arrays in row-major order, and calculating the memory location of elements in two-dimensional arrays based on row and column indexes. Examples are provided to demonstrate computing averages and standard deviations of arrays.
1. Arrays allow storing a collection of related data items and can be one-dimensional or multidimensional.
2. Two-dimensional arrays are arrays of one-dimensional arrays with two indices to access elements.
3. Preprocessor directives like #include and #define are instructions to the compiler and are not part of the C language itself. They expand the scope of the programming environment.
Arrays & Strings can be summarized as follows:
1. Arrays are fixed-size collections of elements of the same data type that are used to store lists of related data. They can be one-dimensional, two-dimensional, or multi-dimensional.
2. Strings in C are arrays of characters terminated by a null character. They are commonly used to store text data. Common string operations include reading, writing, combining, copying, comparing, and extracting portions of strings.
3. Arrays are declared with a data type, name, and size. They can be initialized with a block of comma-separated values. Individual elements are accessed using indexes in square brackets. Two-dimensional arrays represent tables
1. An array is an object that stores a list of values of the same type and is made up of contiguous memory divided into slots indexed from 0 to N-1.
2. One-dimensional arrays use a single subscript to access elements, while two-dimensional and higher dimensional arrays use multiple subscripts to represent rows and columns.
3. Arrays are declared with the syntax Type[] name = new Type[size]; and elements can be accessed using name[index].
The Array is the most commonly used Data Structure.
An array is a collection of data elements that are of the same type (e.g., a collection of integers, collection of characters, collection of doubles).
OR
Array is a data structure that represents a collection of the same types of data.
The values held in an array are called array elements
An array stores multiple values of the same type – the element type
The element type can be a primitive type or an object reference
Therefore, we can create an array of integers, an array of characters, an array of String objects, an array of Coin objects, etc.
The document discusses C arrays and multi-dimensional arrays. It defines arrays as a collection of related data items represented by a single variable name. Arrays must be declared before use with the general form of "type variablename[size]". Elements are accessed via indexes from 0 to size-1. The document also discusses initializing arrays, multi-dimensional arrays with two or more subscripts to represent rows and columns, and provides examples of declaring and initializing multi-dimensional arrays in C.
Arrays are a commonly used data structure that store multiple elements of the same type. Elements in an array are accessed using subscripts or indexes, with the first element having an index of 0. Multidimensional arrays can store elements in rows and columns, accessed using two indexes. Arrays are stored linearly in memory in either row-major or column-major order, which affects how elements are accessed.
An array is a collection of similar elements that are stored in contiguous memory locations. Arrays in C can have one or more dimensions. One-dimensional arrays are declared with the type of elements, name of the array, and number of elements within brackets (e.g. int marks[30]). Multi-dimensional arrays represent matrices and are declared with the number of rows and columns (e.g. int arr[5][10]). Individual elements within an array are accessed via indices (e.g. arr[2][7]). Pointers in C are related to arrays - the name of an array represents the address of its first element, and pointer arithmetic can be used to access successive elements in an array.
The document discusses strings, arrays, pointers, and sorting algorithms in C programming. It provides definitions and examples of:
1) Strings as null-terminated character arrays. It demonstrates initializing and printing a string.
2) One-dimensional and two-dimensional arrays. It shows how to declare, initialize, access, and print multi-dimensional arrays.
3) Pointers as variables that store memory addresses. It explains pointer declaration and dereferencing pointers using asterisk (*) operator.
4) Bubble sort algorithm that iterates through an array and swaps adjacent elements if out of order, putting largest elements at the end of the array in each iteration.
The document discusses arrays in C programming language. It defines arrays as fixed-sized sequenced collections of elements of the same data type that share a common name. One-dimensional arrays represent lists, while two-dimensional arrays represent tables with rows and columns. Arrays must be declared before use with the size specified. Elements can be accessed using indices and initialized. Common operations like input, output, sorting and searching of array elements are demonstrated through examples.
● Introduction to Arrays
● Declaration and initialization of one dimensional and two-dimensional
arrays.
● Definition and initialization of String
● String functions
An array is a contiguous block of memory that stores elements of the same data type. Arrays allow storing and accessing related data collectively under a single name. An array is declared with a data type, name, and size. Elements are accessed via indexes that range from 0 to size-1. Common array operations include initialization, accessing elements using loops, input/output, and finding highest/lowest values. Arrays can be single-dimensional or multi-dimensional. Multi-dimensional arrays represent matrices and elements are accessed using multiple indexes. Common array applications include storing student marks, employee salaries, and matrix operations.
Here is a C program that multiplies two matrices using 2D arrays:
#include <stdio.h>
int main() {
int a[2][2], b[2][2], product[2][2], i, j, k;
printf("Enter elements of first matrix:\n");
for(i=0; i<2; i++)
for(j=0; j<2; j++)
scanf("%d", &a[i][j]);
printf("Enter elements of second matrix:\n");
for(i=0; i<2; i++)
for(j=0; j<2; j++)
scanf("%d", &
Array
Introduction
One-dimensional array
Multidimensional array
Advantage of Array
Write a C program using arrays that produces the multiplication of two matrices.
2D array in C++ language ,define the concept of c++ Two-Dimensional array .with example .and also Accessing Array Components concept.and Processing Two-Dimensional Arrays.
The document discusses one-dimensional arrays in C++. It defines an array as a series of elements of the same type that can be referenced collectively by a common name. These elements are placed in consecutive memory locations and can be individually referenced using a subscript or index. The document covers declaring and initializing one-dimensional arrays, accessing array elements individually and collectively, inputting and displaying array elements, and provides examples of programs that work with arrays.
This document provides an overview of nullables, arrays, and strings in C#. It discusses how C# provides nullable types to allow variables to be assigned null values. It also explains that arrays store a fixed-size collection of elements of the same type and how to declare, initialize, and access array elements. Additionally, it covers multidimensional arrays, jagged arrays, passing arrays as function arguments, and methods of the Array class.
This document discusses arrays in C programming. It begins by defining arrays as fixed-size sequenced collections of related data items that share a common name. It then covers key topics such as declaring and initializing one-dimensional and multi-dimensional arrays, searching and sorting techniques for arrays, and common programming errors related to arrays. Examples are provided to demonstrate array concepts like initialization, indexing, and algorithms for operations like matrix addition.
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schoolsdogden2
Algebra 1 is often described as a “gateway” class, a pivotal moment that can shape the rest of a student’s K–12 education. Early access is key: successfully completing Algebra 1 in middle school allows students to complete advanced math and science coursework in high school, which research shows lead to higher wages and lower rates of unemployment in adulthood.
Learn how The Atlanta Public Schools is using their data to create a more equitable enrollment in middle school Algebra classes.
*Metamorphosis* is a biological process where an animal undergoes a dramatic transformation from a juvenile or larval stage to a adult stage, often involving significant changes in form and structure. This process is commonly seen in insects, amphibians, and some other animals.
Understanding P–N Junction Semiconductors: A Beginner’s GuideGS Virdi
Dive into the fundamentals of P–N junctions, the heart of every diode and semiconductor device. In this concise presentation, Dr. G.S. Virdi (Former Chief Scientist, CSIR-CEERI Pilani) covers:
What Is a P–N Junction? Learn how P-type and N-type materials join to create a diode.
Depletion Region & Biasing: See how forward and reverse bias shape the voltage–current behavior.
V–I Characteristics: Understand the curve that defines diode operation.
Real-World Uses: Discover common applications in rectifiers, signal clipping, and more.
Ideal for electronics students, hobbyists, and engineers seeking a clear, practical introduction to P–N junction semiconductors.
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsesushreesangita003
what is pulse ?
Purpose
physiology and Regulation of pulse
Characteristics of pulse
factors affecting pulse
Sites of pulse
Alteration of pulse
for BSC Nursing 1st semester
for Gnm Nursing 1st year
Students .
vitalsign
How to Subscribe Newsletter From Odoo 18 WebsiteCeline George
Newsletter is a powerful tool that effectively manage the email marketing . It allows us to send professional looking HTML formatted emails. Under the Mailing Lists in Email Marketing we can find all the Newsletter.
How to Manage Opening & Closing Controls in Odoo 17 POSCeline George
In Odoo 17 Point of Sale, the opening and closing controls are key for cash management. At the start of a shift, cashiers log in and enter the starting cash amount, marking the beginning of financial tracking. Throughout the shift, every transaction is recorded, creating an audit trail.
Exploring Substances:
Acidic, Basic, and
Neutral
Welcome to the fascinating world of acids and bases! Join siblings Ashwin and
Keerthi as they explore the colorful world of substances at their school's
National Science Day fair. Their adventure begins with a mysterious white paper
that reveals hidden messages when sprayed with a special liquid.
In this presentation, we'll discover how different substances can be classified as
acidic, basic, or neutral. We'll explore natural indicators like litmus, red rose
extract, and turmeric that help us identify these substances through color
changes. We'll also learn about neutralization reactions and their applications in
our daily lives.
by sandeep swamy
A measles outbreak originating in West Texas has been linked to confirmed cases in New Mexico, with additional cases reported in Oklahoma and Kansas. The current case count is 817 from Texas, New Mexico, Oklahoma, and Kansas. 97 individuals have required hospitalization, and 3 deaths, 2 children in Texas and one adult in New Mexico. These fatalities mark the first measles-related deaths in the United States since 2015 and the first pediatric measles death since 2003.
The YSPH Virtual Medical Operations Center Briefs (VMOC) were created as a service-learning project by faculty and graduate students at the Yale School of Public Health in response to the 2010 Haiti Earthquake. Each year, the VMOC Briefs are produced by students enrolled in Environmental Health Science Course 581 - Public Health Emergencies: Disaster Planning and Response. These briefs compile diverse information sources – including status reports, maps, news articles, and web content– into a single, easily digestible document that can be widely shared and used interactively. Key features of this report include:
- Comprehensive Overview: Provides situation updates, maps, relevant news, and web resources.
- Accessibility: Designed for easy reading, wide distribution, and interactive use.
- Collaboration: The “unlocked" format enables other responders to share, copy, and adapt seamlessly. The students learn by doing, quickly discovering how and where to find critical information and presenting it in an easily understood manner.
CURRENT CASE COUNT: 817 (As of 05/3/2025)
• Texas: 688 (+20)(62% of these cases are in Gaines County).
• New Mexico: 67 (+1 )(92.4% of the cases are from Eddy County)
• Oklahoma: 16 (+1)
• Kansas: 46 (32% of the cases are from Gray County)
HOSPITALIZATIONS: 97 (+2)
• Texas: 89 (+2) - This is 13.02% of all TX cases.
• New Mexico: 7 - This is 10.6% of all NM cases.
• Kansas: 1 - This is 2.7% of all KS cases.
DEATHS: 3
• Texas: 2 – This is 0.31% of all cases
• New Mexico: 1 – This is 1.54% of all cases
US NATIONAL CASE COUNT: 967 (Confirmed and suspected):
INTERNATIONAL SPREAD (As of 4/2/2025)
• Mexico – 865 (+58)
‒Chihuahua, Mexico: 844 (+58) cases, 3 hospitalizations, 1 fatality
• Canada: 1531 (+270) (This reflects Ontario's Outbreak, which began 11/24)
‒Ontario, Canada – 1243 (+223) cases, 84 hospitalizations.
• Europe: 6,814
Multi-currency in odoo accounting and Update exchange rates automatically in ...Celine George
Most business transactions use the currencies of several countries for financial operations. For global transactions, multi-currency management is essential for enabling international trade.
INTRO TO STATISTICS
INTRO TO SPSS INTERFACE
CLEANING MULTIPLE CHOICE RESPONSE DATA WITH EXCEL
ANALYZING MULTIPLE CHOICE RESPONSE DATA
INTERPRETATION
Q & A SESSION
PRACTICAL HANDS-ON ACTIVITY
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessMark Soia
Boost your chances of passing the 2V0-11.25 exam with CertsExpert reliable exam dumps. Prepare effectively and ace the VMware certification on your first try
Quality dumps. Trusted results. — Visit CertsExpert Now: https://www.certsexpert.com/2V0-11.25-pdf-questions.html
This chapter provides an in-depth overview of the viscosity of macromolecules, an essential concept in biophysics and medical sciences, especially in understanding fluid behavior like blood flow in the human body.
Key concepts covered include:
✅ Definition and Types of Viscosity: Dynamic vs. Kinematic viscosity, cohesion, and adhesion.
⚙️ Methods of Measuring Viscosity:
Rotary Viscometer
Vibrational Viscometer
Falling Object Method
Capillary Viscometer
🌡️ Factors Affecting Viscosity: Temperature, composition, flow rate.
🩺 Clinical Relevance: Impact of blood viscosity in cardiovascular health.
🌊 Fluid Dynamics: Laminar vs. turbulent flow, Reynolds number.
🔬 Extension Techniques:
Chromatography (adsorption, partition, TLC, etc.)
Electrophoresis (protein/DNA separation)
Sedimentation and Centrifugation methods.
As of Mid to April Ending, I am building a new Reiki-Yoga Series. No worries, they are free workshops. So far, I have 3 presentations so its a gradual process. If interested visit: https://www.slideshare.net/YogaPrincess
https://ldmchapels.weebly.com
Blessings and Happy Spring. We are hitting Mid Season.
How to Set warnings for invoicing specific customers in odooCeline George
Odoo 16 offers a powerful platform for managing sales documents and invoicing efficiently. One of its standout features is the ability to set warnings and block messages for specific customers during the invoicing process.
2. 2
Two's complement representation
For negative n (–n):
(1) Find w-bit base-2 representation of n
(2) Complement each bit.
(3) Add 1
Example: –88
1. 88 as a 16-bit base-two number 0000000001011000
Same as
sign mag.
For nonnegative n:
Use ordinary base-two representation with leading (sign) bit 0
2. Complement this bit
string
3. Add 1
1111111110100111
1111111110101000
(Flip all bits from rightmost 0 to the
end)
3. 3
Data Type, Data Structure, and Abstract Data Types
Data Type
Set of values that the variable may assume
E.g., boolean = {false, true}, digit = {0, 1, 2, …., 9}
Abstract Data Type
A mathematical model, together with various operations defined on the model
Algorithms are designed in terms of ADTs and implemented in terms of the data
types and operators supported by the programming language
Data Structures
Physical implementation of an ADT
Data structures used in implementations are provided in a language (primitive or
built-in) or are built from the language constructs (user-defined)
Each operation associated with the ADT is implemented by one or more
subroutines in the implementation
4. 4
Separation of interface and implementation
Think of ADT as a black box
ADT is represented by an interface and implementation
is hidden from the user
This means that the ADT can be implemented in various ways,
as long as it adheres to interface
For example, a ListADT can be represented using an array
based implementation or a linked list implementation
5. 5
Linear list data structure
Def: An ordered collection of elements
some examples are an alphabetized list of students, a list of gold
medal winners ordered by year, etc.
With these examples in mind, we feel the need to perform the
following operations on a linear list
Determine whether the list is empty
Determine the size of list
Find the element with a given index
Find the index of a given element
Delete an element given its index
Insert a new element
6. 6
ADT – linear List
The ADT specification is independent of any representation and programming
language
AbstractDataType linearList
{
elements
ordered finite collection of zero or more elements
operations
empty(): return true if the list is empty
size(): return the list size
get(index): return the indexth element
indexOf(x): return the index of the first occurance of x in
the list, returns -1, if x is not in the list
erase(index): delete the indexth element, element with higher
index have their index reduced by 1
insert(index, x): insert x as the indexth element
output(): output the list elements from left to right
7. 7
Array representation
[5, 2, 4, 8,1]
Some of the implementations can be
1
8
4
2
5
location(i) = i
5
2
4
8
1
location(i) = 9- i
4
2
5
1
8
location(i) = (7+i)%10
8. C++ Style Data Structures:
Arrays(1)
• An ordered set (sequence) with a fixed
number of elements, all of the same
type,
where the basic operation is
direct access to each element in the
array so values can be retrieved from
or stored in this element.
9. C++ Style Data Structures: Arrays (2)
Properties:
Ordered so there is a first element, a second one, etc.
Fixed number of elements — fixed capacity
Elements must be the same type (and size);
use arrays only for homogeneous data sets.
Direct access: Access an element by giving its location
The time to access each element is the same for all elements,
regardless of position.
in contrast to sequential access (where to access an element,
one must first access all those that precede it.)
10. Declaring arrays in C++
where
element_type is any type
array_name is the name of the array — any valid identifier
CAPACITY (a positive integer constant) is the number of
elements in the array
score[0]
score[1]
score[2]
score[3]
score[99]
.
.
.
.
.
.
element_type array_name[CAPACITY];
e.g., double score[100];
The elements (or positions) of the array are indexed
0, 1, 2, . . ., CAPACITY - 1.
Can't input the capacity,
Why?
The compiler reserves a block of “consecutive”
memory locations, enough to hold CAPACITY values
of type element_type.
11. indices numbered 0, 1, 2, . . ., CAPACITY -
1
How well does C/C++ implement an array ADT?
As an ADT In C++
ordered
fixed size
same type
elements
direct access
element_type is the type of elements
CAPACITY specifies the capacity of the array
subscript operator
[]
12. an array literal
Array Initialization
Example:
double rate[5] = {0.11, 0.13, 0.16, 0.18, 0.21};
Note 1: If fewer values supplied than array's capacity, remaining
elements assigned 0.
double rate[5] = {0.11, 0.13, 0.16};
Note 2: It is an error if more values are supplied than the declared size of the
array.
How this error is handled, however, will vary from one compiler to
another.
rate
0 1 2 3 4
0.11 0.13 0.16 0 0
rate
0 1 2 3 4
0.11 0.13 0.16 0.18 0.21
In C++, arrays can be initialized when they are declared.
Numeric arrays:
element_type num_array[CAPACITY] = {list_of_initial_values};
13. Note 1: If fewer values are supplied than the declared size of the array,
the zeroes used to fill un-initialized elements are interpreted as
the null character '0' whose ASCII code is 0.
const int NAME_LENGTH = 10;
char collegeName[NAME_LENGTH]={'C', 'a', 'l', 'v', 'i', 'n'};
vowel
0 1 2 3 4
A E I O U
char vowel[5] = {'A', 'E', 'I', 'O', 'U'};
Character Arrays:
Character arrays may be initialized in the same manner as numeric
arrays.
declares vowel to be an array of 5 characters and initializes it as
follows:
collegeName
0 1 2 3 4 5 6 7 8 9
C a l v i n 0 0 0 0
14. Addresses
When an array is declared, the address of the first byte (or word) in the
block of memory associated with the array is called the base address of
the array.
Each array reference must be translated into an offset from this base
address.
For example, if each element of array score will be stored in 8 bytes and
the base address of score is 0x1396. A statement such as
cout << score[3] << endl;
requires that array reference
score[3]
be translated into a memory address:
0x1396 + 3 * sizeof
(double)
= 0x1396 + 3 * 8
= 0x13ae
The contents of the memory word with this
address 0x13ae can then be retrieved and
displayed.
An address translation like this is carried out
each time an array element is accessed.
score[3]
[0]
[1]
[2]
[3]
[99]
.
.
.
.
.
.
score 0x1396
0x13ae
What will be the
time complexity
15. The value of array_name is actually the base address of array_name
array_name + index is the address of array_name[index].
An array reference array_name[index]
is equivalent to
For example, the following statements of pseudocode are
equivalent:
print score[3]
print *(score + 3)
Note: No bounds checking of indices is done!
* is the dereferencing operator
*ref returns the contents of the memory location with
address ref
*(array_name + index)
What will happen
incase
of going overboard
16. Problems with Arrays
1. The capacity of Array can NOT change during program
execution.
What is the problem?
Memory wastage
Out of range errors
2. Arrays are NOT self contained objects
What is the problem?
No way to find the last value stored.
Not a self contained object as per OOP principles.
17. C++ Style Multidimensional
Arrays
Most high level languages support arrays with more than one
dimension.
2D arrays are useful when data has to be arranged in tabular form.
Higher dimensional arrays appropriate when several
characteristics associated with data.
Test 1 Test 2 Test 3 Test 4
Student 1 99.0 93.5 89.0 91.0
Student 2 66.0 68.0 84.5 82.0
Student 3 88.5 78.5 70.0 65.0
: : : : :
: : : : :
Student-n 100.0 99.5 100.0 99.0
For storage and processing, use a two-dimensional
array.
Example: A table of test scores for several different
students on
several different tests.
18. Declaring Two-Dimensional
Arrays
Standard form of declaration:
element_type array_name[NUM_ROWS][NUM_COLUMNS];
Example:
const int NUM_ROWS = 30,
NUM_COLUMNS = 4;
double scoresTable[NUM_ROWS][NUM_COLUMNS];
Initialization
List the initial values in braces, row by row;
May use internal braces for each row to improve readability.
Example:
double rates[][] = {{0.50, 0.55, 0.53}, // first row
{0.63, 0.58, 0.55}}; // second row
[0]
[1]
[2]
[3]
[29]
[0] [[1] [2] [3]
19. Processing Two-Dimensional
Arrays
Remember: Rows (and) columns are numbered from zero!!
Use doubly-indexed variables:
scoresTable[2][3] is the entry in row 2 and column 3
row index column index
Use nested loops to vary the two indices, most often in a rowwise
manner.
Counting
from 0
20. Higher-Dimensional Arrays
The methods for 2D arrays extend in the obvious way to 3D arrays.
Example: To store and process a table of test scores for several different
students on several different tests for several different semesters
const int SEMS = 10, STUDENTS = 30, TESTS = 4;
typedef double ThreeDimArray[SEMS][STUDENTS][TESTS];
ThreeDimArray gradeBook;
gradeBook[4][2][3]
is the score of 4th
semester for student 2 on test 3
// number of semesters, students and tests all counted from zero!!
21. Arrays of Arrays
double scoresTable[30][4];
Declares scoresTable to be a one-dimensional array containing
30 elements, each of which is a one-dimensional array of 4 real numbers; tha
scoresTable is a one-dimensional array of rows , each of which has 4
real values. We could declare it as
typedef double RowOfTable[4];
RowOfTable scoresTable[30];
[0]
[1]
[2]
[3]
[29]
[0] [[1] [2] [3]
[0] [[1] [2] [3]
[0]
[1]
[2]
[3]
[29]
22. scoresTable[i] is the i-th row of the table
Address Translation:
Address Translation:
The array-of-arrays structure of multidimensional arrays explains
address translation.
Suppose the base address of scoresTable is 0x12348:
scoresTable[10] 0x12348 + 10*(sizeof RowOfTable)
In general, an n-dimensional array can be viewed (recursively) as a
one-dimensional array whose elements are (n - 1)-dimensional arrays.
In any case:
scoresTable[i][j] should be thought of as (scoresTable[i])[j]
that is, as finding the j-th element of scoresTable[i].
scoresTable[10]
[3] base(scoresTable[10]) + 3*(sizeof double)
scoresTable[10]
[4]
[3]
[0]
[1]
[9]
[10]
= 0x12348 + 10 * (4 * 8) + 3 * 8
= 0x124a0
= 0x12348 + 10 * (4 * 8)
23. Implementing Multidimensional
Arrays
More complicated than one dimensional arrays.
Memory is organized as a sequence of memory locations, and is
thus 1D
How to use a 1D structure to store a MD structure?
A B C D
E F G H
I J K L
A character requires a single byte
Compiler instructed to reserve 12 consecutive bytes
Two ways to store consecutively i.e. rowwise and columnwise.
24. Implementing Multidimensional
Arrays
A B C D
E F G H
I J K L
Row
Wise
A
B
C
D
E
F
G
H
I
J
K
L
Column Wise
A
E
I
B
F
J
C
G
K
D
H
L
A B C D
E F G H
I J K L
A B C D
E F G H
I J K L