SlideShare a Scribd company logo
MODELS OF COMPUTATION
Submitted To:- Submitted By:-
Ms. Shano Solnaki Alpana (171401)
Astt. Professor ME Modular 2017
Computer Science & Engg. 9459942212
NITTTR Chandigarh anshubhaskar93@gmail.com
Contents
 Computational Model
 Random Access Machine
 Stored program model or von Neumann model of a computer
 Difference between Random access machine and Random Access
Memory
 References
2
Computational Model
 “A computational model is a mathematical model in
computational science that requires extensive computational
resources to study the behavior of a complex system by computer
simulation.
 The common basis of programming language and computer
architecture is known as computational model.
 Provides higher level of abstraction than the programming
language and the architecture.
 Computational model is the combination of the above two.
3
Contd…
 Algorithms are most important and durable part of computer science
because they can be studied in a language- and machine-
independent way.
 This means that we need techniques that capable us to compare
the efficiency of algorithms without implementing them. Our two
most important tools are:
 The RAM model of computation and,
 The asymptotic analysis of worst-case complexity.
4
The RAM Model
 Random Access Machine (not R.A. Memory)
 An idealized notion of how the computer works
 Each "simple" operation (+, -, =, if) takes exactly 1 step.
 Each memory access takes exactly 1 step
 Loops and method calls are not simple operations, but depend upon the size
of the data and the contents of the method.
 Measure the run time of an algorithm by counting the number of steps.
 The program for RAM is not stored in memory.
 Thus we are assuming that the program does not modify itself.
5
A Random Access Machine (RAM) consists of:
 a fixed program
 an unbounded memory
 a read-only input tape
 a write-only output tape
 Each memory register can hold an arbitrary integer (*).
 Each tape cell can hold a single symbol from a finite alphabet s.
6
Space Complexity
 The amount of memory required by an algorithm to run to
completion.
 Fixed part: The size required to store certain data/variables, that is
independent of the size of the problem: Such as int a (2 bytes, float
b (4 bytes) etc
 Variable part: Space needed by variables, whose size is dependent
on the size of the problem: Dynamic array a[]
7
Space Complexity (cont’d)
 S(P) = c + S(instance characteristics)
 c = constant
 Example:
void float sum
(float* a, int n) {
float s = 0;
for(int i = 0; i<n; i++) {
s+ = a[i]; }
return s;
Constant Space: one for n, one for a [passed by reference!], one for
s, one for I , constant space=c=4 8
Running Time of Algorithms
 depends on input size n
 size of an array
 polynomial degree
 elements in a matrix
 bits in the binary representation of the input vertices and edges in a
graph
 number of primitive operations performed
 Primitive operation
 unit of operation that can be identified in the pseudo-code 9
Steps To determine Time Complexity
 Step-1. Determine how you will measure input size.
 Ex:
N items in a list N x M table (with N rows and M columns)
Two numbers of length N
 Step-2. Choose the type of operation (or perhaps two operations)
 Comparisons, Swaps, Copies ,Additions .
Note: Normally we don't count operations in input/output.
10
Steps To determine Time Complexity (Cont !!!)
 Step-3. Decide whether you wish to count operations in the
 Best case? - the fewest possible operations
 Worst case? - the most possible operations Average case? This is
harder as it is not always clear what is meant by an "average case".
 Normally calculating this case requires some higher mathematics
such as probability theory.
 Step-4. For the algorithm and the chosen case (best, worst, average),
express the count as a function of the input size of the problem.
11
Primitive Operations in an algorithm
 Assign a value to a variable (i.e. a=5)
 Call a method (i.e. method())
 Arithmetic operation (i.e. a*b, a-b*c)
 Comparing two numbers ( i.e. a<=b, a>b &&a>c)
 Indexing into an array (i.e. a[0]=5)
 Following an object reference (i.e. Test obj) Returning from a
method (i.e. return I )
12
for Loops
 The running time of a for loop is at most the running time of the
statements inside the for loop (including tests) times the number of
iterations.
 Example
 For(i=0;i<=n-1;i++)
 A[i]=0;
 Let running time of basic operations is constant C and loop is
iterated n times then Total Running time will be n*c
 Note: (number of basic steps in loop body) * (number of
iterations) 13
Primitive Operations:
 Example -1
Count the number of primitive
operations in this program :
Int method() {
i = 0;
a = 0;
for (i=1;i<=n;i++) {
printf(“%d”,i);
a=a+i;
}
return I
}
 Primitive Operations Yes/No
 Total Assign a value to a variable
 Call a method
 Arithmetic operation
 Comparing two numbers
 Indexing into an array
 Following an object reference
Returning from a method
14
Primitive Operations:
 Yes/No
 Total Assign a value to a variable Yes 5
 Call a method No
 Arithmetic operation 2
 Comparing two numbers 1
 Indexing into an array
 Following an object reference Returning from a method
15
RASP Machine or stored program model
 Same as RAM but allow program to change itself as it is now stored
in the memory
 Same power as RAM
 Example Von Neumann architecture
 Let RAM use memory registers to store modifiable program of
RASP
16
Stored program model or von Neumann model of a
computer.
 Around 1944–1945, John von Neumann proposed that, since
program and data are logically the same, programs should also be
stored in the memory of a computer.
 Computers built on the von Neumann model divide the computer
hardware into four subsystems: memory, arithmetic logic unit,
control unit, and input/output.
17
The stored program concept
 The von Neumann model states that the program must be stored in
memory. This is totally different from the architecture of early
computers in which only the data was stored in memory: the
programs for their task was implemented by manipulating a set of
switches or by changing the wiring system.
 The memory of modern computers hosts both a program and its
corresponding data. This implies that both the data and programs
should have the same format, because they are stored in memory. In
fact, they are stored as binary patterns in memory—a sequence of 0s
and 1s.
18
Sequential execution of instructions
 A program in the von Neumann model is made of a finite number of
instructions.
 In this model, the control unit fetches one instruction from memory,
decodes it, then executes it. In other words, the instructions are
executed one after another.
 Of course, one instruction may request the control unit to jump to
some previous or following instruction, but this does not mean that
the instructions are not executed sequentially.
19
Sequential execution of instructions
 Sequential execution of a program was the initial requirement of a
computer based on the von Neumann model.
 Today’s computers execute programs in the order that is the most
efficient.
20
What is the difference between random access machine
and random access memory?
 The Random Access Machine is a simplified model of a
modern computer used in theoretical computer science to
analyze algorithms.
 Random Access Memory is the primary memory device in
which the CPU stores data in a real life computer.
21
References
 http://slideplayer.com/slide/5149671/
 http://slideplayer.com/slide/7702888/
 https://www.youtube.com/watch?v=oI8S8qTw1_E
 Aho, Hopcroft, Ullman: The Design and analysis of
algorithms”,
Pearson Education.
22
23

More Related Content

Recently uploaded

BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
khuleseema60
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.
IsmaelVazquez38
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
Celine George
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
heathfieldcps1
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
Celine George
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
nitinpv4ai
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
David Douglas School District
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 

Recently uploaded (20)

BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025MDP on air pollution of class 8 year 2024-2025
MDP on air pollution of class 8 year 2024-2025
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.Bossa N’ Roll Records by Ismael Vazquez.
Bossa N’ Roll Records by Ismael Vazquez.
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17How Barcodes Can Be Leveraged Within Odoo 17
How Barcodes Can Be Leveraged Within Odoo 17
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
 
Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)Oliver Asks for More by Charles Dickens (9)
Oliver Asks for More by Charles Dickens (9)
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 

Featured

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
GetSmarter
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
Alireza Esmikhani
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
Erica Santiago
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
 

Featured (20)

Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
 
Barbie - Brand Strategy Presentation
Barbie - Brand Strategy PresentationBarbie - Brand Strategy Presentation
Barbie - Brand Strategy Presentation
 
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them wellGood Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
 

Models of computation(Algorithm)

  • 1. MODELS OF COMPUTATION Submitted To:- Submitted By:- Ms. Shano Solnaki Alpana (171401) Astt. Professor ME Modular 2017 Computer Science & Engg. 9459942212 NITTTR Chandigarh anshubhaskar93@gmail.com
  • 2. Contents  Computational Model  Random Access Machine  Stored program model or von Neumann model of a computer  Difference between Random access machine and Random Access Memory  References 2
  • 3. Computational Model  “A computational model is a mathematical model in computational science that requires extensive computational resources to study the behavior of a complex system by computer simulation.  The common basis of programming language and computer architecture is known as computational model.  Provides higher level of abstraction than the programming language and the architecture.  Computational model is the combination of the above two. 3
  • 4. Contd…  Algorithms are most important and durable part of computer science because they can be studied in a language- and machine- independent way.  This means that we need techniques that capable us to compare the efficiency of algorithms without implementing them. Our two most important tools are:  The RAM model of computation and,  The asymptotic analysis of worst-case complexity. 4
  • 5. The RAM Model  Random Access Machine (not R.A. Memory)  An idealized notion of how the computer works  Each "simple" operation (+, -, =, if) takes exactly 1 step.  Each memory access takes exactly 1 step  Loops and method calls are not simple operations, but depend upon the size of the data and the contents of the method.  Measure the run time of an algorithm by counting the number of steps.  The program for RAM is not stored in memory.  Thus we are assuming that the program does not modify itself. 5
  • 6. A Random Access Machine (RAM) consists of:  a fixed program  an unbounded memory  a read-only input tape  a write-only output tape  Each memory register can hold an arbitrary integer (*).  Each tape cell can hold a single symbol from a finite alphabet s. 6
  • 7. Space Complexity  The amount of memory required by an algorithm to run to completion.  Fixed part: The size required to store certain data/variables, that is independent of the size of the problem: Such as int a (2 bytes, float b (4 bytes) etc  Variable part: Space needed by variables, whose size is dependent on the size of the problem: Dynamic array a[] 7
  • 8. Space Complexity (cont’d)  S(P) = c + S(instance characteristics)  c = constant  Example: void float sum (float* a, int n) { float s = 0; for(int i = 0; i<n; i++) { s+ = a[i]; } return s; Constant Space: one for n, one for a [passed by reference!], one for s, one for I , constant space=c=4 8
  • 9. Running Time of Algorithms  depends on input size n  size of an array  polynomial degree  elements in a matrix  bits in the binary representation of the input vertices and edges in a graph  number of primitive operations performed  Primitive operation  unit of operation that can be identified in the pseudo-code 9
  • 10. Steps To determine Time Complexity  Step-1. Determine how you will measure input size.  Ex: N items in a list N x M table (with N rows and M columns) Two numbers of length N  Step-2. Choose the type of operation (or perhaps two operations)  Comparisons, Swaps, Copies ,Additions . Note: Normally we don't count operations in input/output. 10
  • 11. Steps To determine Time Complexity (Cont !!!)  Step-3. Decide whether you wish to count operations in the  Best case? - the fewest possible operations  Worst case? - the most possible operations Average case? This is harder as it is not always clear what is meant by an "average case".  Normally calculating this case requires some higher mathematics such as probability theory.  Step-4. For the algorithm and the chosen case (best, worst, average), express the count as a function of the input size of the problem. 11
  • 12. Primitive Operations in an algorithm  Assign a value to a variable (i.e. a=5)  Call a method (i.e. method())  Arithmetic operation (i.e. a*b, a-b*c)  Comparing two numbers ( i.e. a<=b, a>b &&a>c)  Indexing into an array (i.e. a[0]=5)  Following an object reference (i.e. Test obj) Returning from a method (i.e. return I ) 12
  • 13. for Loops  The running time of a for loop is at most the running time of the statements inside the for loop (including tests) times the number of iterations.  Example  For(i=0;i<=n-1;i++)  A[i]=0;  Let running time of basic operations is constant C and loop is iterated n times then Total Running time will be n*c  Note: (number of basic steps in loop body) * (number of iterations) 13
  • 14. Primitive Operations:  Example -1 Count the number of primitive operations in this program : Int method() { i = 0; a = 0; for (i=1;i<=n;i++) { printf(“%d”,i); a=a+i; } return I }  Primitive Operations Yes/No  Total Assign a value to a variable  Call a method  Arithmetic operation  Comparing two numbers  Indexing into an array  Following an object reference Returning from a method 14
  • 15. Primitive Operations:  Yes/No  Total Assign a value to a variable Yes 5  Call a method No  Arithmetic operation 2  Comparing two numbers 1  Indexing into an array  Following an object reference Returning from a method 15
  • 16. RASP Machine or stored program model  Same as RAM but allow program to change itself as it is now stored in the memory  Same power as RAM  Example Von Neumann architecture  Let RAM use memory registers to store modifiable program of RASP 16
  • 17. Stored program model or von Neumann model of a computer.  Around 1944–1945, John von Neumann proposed that, since program and data are logically the same, programs should also be stored in the memory of a computer.  Computers built on the von Neumann model divide the computer hardware into four subsystems: memory, arithmetic logic unit, control unit, and input/output. 17
  • 18. The stored program concept  The von Neumann model states that the program must be stored in memory. This is totally different from the architecture of early computers in which only the data was stored in memory: the programs for their task was implemented by manipulating a set of switches or by changing the wiring system.  The memory of modern computers hosts both a program and its corresponding data. This implies that both the data and programs should have the same format, because they are stored in memory. In fact, they are stored as binary patterns in memory—a sequence of 0s and 1s. 18
  • 19. Sequential execution of instructions  A program in the von Neumann model is made of a finite number of instructions.  In this model, the control unit fetches one instruction from memory, decodes it, then executes it. In other words, the instructions are executed one after another.  Of course, one instruction may request the control unit to jump to some previous or following instruction, but this does not mean that the instructions are not executed sequentially. 19
  • 20. Sequential execution of instructions  Sequential execution of a program was the initial requirement of a computer based on the von Neumann model.  Today’s computers execute programs in the order that is the most efficient. 20
  • 21. What is the difference between random access machine and random access memory?  The Random Access Machine is a simplified model of a modern computer used in theoretical computer science to analyze algorithms.  Random Access Memory is the primary memory device in which the CPU stores data in a real life computer. 21
  • 22. References  http://slideplayer.com/slide/5149671/  http://slideplayer.com/slide/7702888/  https://www.youtube.com/watch?v=oI8S8qTw1_E  Aho, Hopcroft, Ullman: The Design and analysis of algorithms”, Pearson Education. 22
  • 23. 23

Editor's Notes

  1. NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image.