SlideShare a Scribd company logo
1 of 1
Download to read offline
To determine how much "space" (i.e, memory or RAM) a program requires, we need to figure
cut where memory is created. Memory can be created statically (i.e. variable declarations) or
dynamically (i.e. when each statement is executed). In the program prob 8 below, for each line of
code from 5 to 12, specify if memory is created statically, dynamically, or not at all ]: # Input: L
is a list of numbers # def probs(L): if len (L)<=1 : return 1 total =0 for x in L: total +=xx left
=1.[:len(L)//2] right = L. [len(L)//2:Ien(L)] return probs (left)+probs(right)+tota1
Find the space functionlequation, S(n), of prob8 (defined in the previous problem). Note that
S(n) is the space (memoryIRAM) allocated to probs, when its input (Le. L) has n numbers.
(Conceptually, if the input size is 10 , the amount of spaco required is S(10)) Note that slicing k
things from a list (e.g- lines 10 and 11 below) takes k steps because Python creates a new list,
then copies these things into a new list, and retums it. For example, in line 10, Python wil copy
all items from 0 to len(L) y/2, put them in a new list and then retums it (save it into "leh").

More Related Content

Similar to To determine how much space (i.e, memory or RAM) a program requires.pdf

Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
Kurmendra Singh
 

Similar to To determine how much space (i.e, memory or RAM) a program requires.pdf (20)

Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013Dsp lab _eec-652__vi_sem_18012013
Dsp lab _eec-652__vi_sem_18012013
 
MatlabIntro.ppt
MatlabIntro.pptMatlabIntro.ppt
MatlabIntro.ppt
 
MatlabIntro.ppt
MatlabIntro.pptMatlabIntro.ppt
MatlabIntro.ppt
 
MatlabIntro.ppt
MatlabIntro.pptMatlabIntro.ppt
MatlabIntro.ppt
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 
MatlabIntro.ppt
MatlabIntro.pptMatlabIntro.ppt
MatlabIntro.ppt
 
Problem solving using computers - Chapter 1
Problem solving using computers - Chapter 1 Problem solving using computers - Chapter 1
Problem solving using computers - Chapter 1
 
Scala as a Declarative Language
Scala as a Declarative LanguageScala as a Declarative Language
Scala as a Declarative Language
 
3.5
3.53.5
3.5
 
Matlab-3.pptx
Matlab-3.pptxMatlab-3.pptx
Matlab-3.pptx
 
Recursion vs. Iteration: Code Efficiency & Structure
Recursion vs. Iteration: Code Efficiency & StructureRecursion vs. Iteration: Code Efficiency & Structure
Recursion vs. Iteration: Code Efficiency & Structure
 
Create and analyse programs
Create and analyse programsCreate and analyse programs
Create and analyse programs
 
An Intoduction to R
An Intoduction to RAn Intoduction to R
An Intoduction to R
 
Notes7
Notes7Notes7
Notes7
 
Alp 05
Alp 05Alp 05
Alp 05
 
Alp 05
Alp 05Alp 05
Alp 05
 
Loops in Python
Loops in PythonLoops in Python
Loops in Python
 
1. Ch_1 SL_1_Intro to Matlab.pptx
1. Ch_1 SL_1_Intro to Matlab.pptx1. Ch_1 SL_1_Intro to Matlab.pptx
1. Ch_1 SL_1_Intro to Matlab.pptx
 
Basic concept of MATLAB.ppt
Basic concept of MATLAB.pptBasic concept of MATLAB.ppt
Basic concept of MATLAB.ppt
 
pyton Notes9
pyton Notes9pyton Notes9
pyton Notes9
 

More from agarvaltrading

More from agarvaltrading (20)

Trillium Import has one of the largest selection of imported food.pdf
 Trillium Import has one of the largest selection of imported food.pdf Trillium Import has one of the largest selection of imported food.pdf
Trillium Import has one of the largest selection of imported food.pdf
 
Trillum Import has one of the iarset selection of imported food produ.pdf
 Trillum Import has one of the iarset selection of imported food produ.pdf Trillum Import has one of the iarset selection of imported food produ.pdf
Trillum Import has one of the iarset selection of imported food produ.pdf
 
Tratededsa ise Mou 1 Timestins for hes 2 Thintine armunt swanoas for .pdf
 Tratededsa ise Mou 1 Timestins for hes 2 Thintine armunt swanoas for .pdf Tratededsa ise Mou 1 Timestins for hes 2 Thintine armunt swanoas for .pdf
Tratededsa ise Mou 1 Timestins for hes 2 Thintine armunt swanoas for .pdf
 
Transposable elements (TEs) make up 50 of the human genome. Similar .pdf
 Transposable elements (TEs) make up 50 of the human genome. Similar .pdf Transposable elements (TEs) make up 50 of the human genome. Similar .pdf
Transposable elements (TEs) make up 50 of the human genome. Similar .pdf
 
Transgression Regression Stratigraphic Column List possible EOD On .pdf
 Transgression  Regression Stratigraphic Column List possible EOD On .pdf Transgression  Regression Stratigraphic Column List possible EOD On .pdf
Transgression Regression Stratigraphic Column List possible EOD On .pdf
 
Topic Three News and Microeconomics This week we focused on four dif.pdf
 Topic Three News and Microeconomics This week we focused on four dif.pdf Topic Three News and Microeconomics This week we focused on four dif.pdf
Topic Three News and Microeconomics This week we focused on four dif.pdf
 
todos estos se registran en el anexo M-2 excepto 1) cuenta de aju.pdf
 todos estos se registran en el anexo M-2 excepto 1) cuenta de aju.pdf todos estos se registran en el anexo M-2 excepto 1) cuenta de aju.pdf
todos estos se registran en el anexo M-2 excepto 1) cuenta de aju.pdf
 
To complete this worksheet, see the instructions in the textbook (Cha.pdf
 To complete this worksheet, see the instructions in the textbook (Cha.pdf To complete this worksheet, see the instructions in the textbook (Cha.pdf
To complete this worksheet, see the instructions in the textbook (Cha.pdf
 
TITLE MAKE A PROJECT ON THE WORKING OF PARLIAMENTARY FORM OF GOVERNM.pdf
 TITLE MAKE A PROJECT ON THE WORKING OF PARLIAMENTARY FORM OF GOVERNM.pdf TITLE MAKE A PROJECT ON THE WORKING OF PARLIAMENTARY FORM OF GOVERNM.pdf
TITLE MAKE A PROJECT ON THE WORKING OF PARLIAMENTARY FORM OF GOVERNM.pdf
 
Thomson Trucking has $24 billion in assets, and its tax rate is 2.pdf
 Thomson Trucking has $24 billion in assets, and its tax rate is 2.pdf Thomson Trucking has $24 billion in assets, and its tax rate is 2.pdf
Thomson Trucking has $24 billion in assets, and its tax rate is 2.pdf
 
Three-spined red bellied sticklebacks were reared in the lab in isola.pdf
 Three-spined red bellied sticklebacks were reared in the lab in isola.pdf Three-spined red bellied sticklebacks were reared in the lab in isola.pdf
Three-spined red bellied sticklebacks were reared in the lab in isola.pdf
 
three assets purchased for a total cost of $150,000 in exchange for a.pdf
 three assets purchased for a total cost of $150,000 in exchange for a.pdf three assets purchased for a total cost of $150,000 in exchange for a.pdf
three assets purchased for a total cost of $150,000 in exchange for a.pdf
 
Their abbreviated Statement of Comprehensive Income for the year ende.pdf
 Their abbreviated Statement of Comprehensive Income for the year ende.pdf Their abbreviated Statement of Comprehensive Income for the year ende.pdf
Their abbreviated Statement of Comprehensive Income for the year ende.pdf
 
The wrongful interference with someones goods includes a) Trespass .pdf
 The wrongful interference with someones goods includes a) Trespass .pdf The wrongful interference with someones goods includes a) Trespass .pdf
The wrongful interference with someones goods includes a) Trespass .pdf
 
The table below gives the data about Etrurias balance of payment.pdf
 The table below gives the data about Etrurias balance of payment.pdf The table below gives the data about Etrurias balance of payment.pdf
The table below gives the data about Etrurias balance of payment.pdf
 
The Social Security Administration increased the taxable wage base fr.pdf
 The Social Security Administration increased the taxable wage base fr.pdf The Social Security Administration increased the taxable wage base fr.pdf
The Social Security Administration increased the taxable wage base fr.pdf
 
The risk manacer and hic team develoned the risk recister the risk re.pdf
 The risk manacer and hic team develoned the risk recister the risk re.pdf The risk manacer and hic team develoned the risk recister the risk re.pdf
The risk manacer and hic team develoned the risk recister the risk re.pdf
 
The S&P 500 Index is at 4100 now. Assume a continuously compounding .pdf
 The S&P 500 Index is at 4100 now. Assume a continuously compounding .pdf The S&P 500 Index is at 4100 now. Assume a continuously compounding .pdf
The S&P 500 Index is at 4100 now. Assume a continuously compounding .pdf
 
The provided graph depicts Julies budget constraints and indifferenc.pdf
 The provided graph depicts Julies budget constraints and indifferenc.pdf The provided graph depicts Julies budget constraints and indifferenc.pdf
The provided graph depicts Julies budget constraints and indifferenc.pdf
 
The pension fund paid out benefits in each year. There were no actuar.pdf
 The pension fund paid out benefits in each year. There were no actuar.pdf The pension fund paid out benefits in each year. There were no actuar.pdf
The pension fund paid out benefits in each year. There were no actuar.pdf
 

Recently uploaded

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Recently uploaded (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 

To determine how much space (i.e, memory or RAM) a program requires.pdf

  • 1. To determine how much "space" (i.e, memory or RAM) a program requires, we need to figure cut where memory is created. Memory can be created statically (i.e. variable declarations) or dynamically (i.e. when each statement is executed). In the program prob 8 below, for each line of code from 5 to 12, specify if memory is created statically, dynamically, or not at all ]: # Input: L is a list of numbers # def probs(L): if len (L)<=1 : return 1 total =0 for x in L: total +=xx left =1.[:len(L)//2] right = L. [len(L)//2:Ien(L)] return probs (left)+probs(right)+tota1 Find the space functionlequation, S(n), of prob8 (defined in the previous problem). Note that S(n) is the space (memoryIRAM) allocated to probs, when its input (Le. L) has n numbers. (Conceptually, if the input size is 10 , the amount of spaco required is S(10)) Note that slicing k things from a list (e.g- lines 10 and 11 below) takes k steps because Python creates a new list, then copies these things into a new list, and retums it. For example, in line 10, Python wil copy all items from 0 to len(L) y/2, put them in a new list and then retums it (save it into "leh").