SlideShare uma empresa Scribd logo
1 de 23
LECTURE 23
BY: RUBYNA VOHRA
AGENDA
• Memory
• Garbage Collection
• Big O Notation (Runtime)
• Doubly LinkedLists
MEMORY
WHAT IS MEMORY IN COMPUTER SCIENCE?
• Memory is the area where the computer stores or remembers data.
• Some types of computer memory are designed to be very fast, meaning that the
central processing unit (CPU) can access data stored there very quickly.
• Your computer's main memory is called RAM (Random Access Memory).
• You can think of it as a workspace the computer uses to get work done. When you double-
click on an app, or open a document, or, well, do much of anything, RAM gets used to store
that data while the computer is working on it.
• H
WHY IS MEMORY IMPORTANT?
• RAM allows your computer to perform many of its everyday tasks, such as
loading applications, browsing the internet, editing a spreadsheet, or
experiencing the latest game.
• Memory also allows you to switch quickly among these tasks, remembering
where you are in one task when you switch to another task.
• It holds the data and instructions that the Central Processing Unit (CPU) needs
• This allows the CPU direct access to the computer program.
• Memory is needed in all computers
GARBAGE COLLECTION
WHAT IS GARBAGE COLLECTION?
• The garbage collector (GC) manages the allocation and release of memory
• When there isn't enough memory to allocate an object, the GC must collect and
dispose of garbage memory to make memory available for new allocations. This
process is known as garbage collection.
• Garbage Collection in C# has the following advantages −
• You don’t need to free memory manually while developing your application.
• It also allocates objects on the managed heap efficiently.
• When objects are no longer used then it will reclaim those objects by
clearing their memory and keeps the memory available for future
allocations.
• Managed objects automatically get clean content to start with, so their
constructors do not have to initialize every data field.
BIG O NOTATION (RUNTIME)
WHAT IS BIG O NOTATION?
• Big O notation is used in Computer Science to describe the performance or complexity of an
algorithm.
• Big O specifically describes the worst-case scenario, and can be used to describe the execution
time required or the space used (e.g. in memory or on disk) by an algorithm.
• Big O notation is a measure of the complexity of your program in terms of the size of the input.
• The size of the input is usually denote as ‘n’. There are usually 2 ways to measure the complexity:
• Time: The number of calculations your program must perform on the input data to get the output.
• For example finding the biggest number in a list of n numbers requires you to check every number
against against your current maximum and see if the new number is higher. Thus for n numbers you need
n checks, or calculations. This has linear time complexity because there is a 1 to 1 relationship between
input the number of calculations to obtain the output. Linear time complexity is denoted as O(n).
• Space: The amount of storage space needed by the program to run its calculations.
• We will use the above example of finding the biggest number in a list of n numbers. We need a variable
to store our current maximum number value. If we have 10 numbers, we need 1 variable, if we have a
million numbers, we still need 1 variable. The number of variables we need is constant compared to the
input size, so our program has constant space complexity, denoted as O(1).
LIVE WALKTHRU/EXPLANATION
• Write code for each of the runtimes discussed
• Share out – the class will guess what runtime your code is displaying
DOUBLY LINKEDLISTS
WHAT IS A DOUBLY LINKEDLIST?
• In computer science, a doubly linked list is a linked data structure that consists of a set
of sequentially linked records called nodes. Each node contains three fields: two link
fields and one data field.
THE DIFFERENCE BETWEEN A LINKEDLIST AND
DOUBLY LINKEDLIST
• A Doubly LinkedLists has references that goes both ways compared to a Singly
LinkedList that has references pointing one way
LIVE WALKTHRU/EXPLANATION
DISCUSSION
• Why is this important?
• How can this be useful to me?
• How can I use this in my current
job?
• How can I use this in my future
career?
• What will I get out of this?
• How is this used in the real world
Regroup and discuss after…
COMPLETE THE
WORKSHEET WITH
YOUR GROUP
Regroup and discuss after…

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Unit 1 program development cycle
Unit 1 program development cycleUnit 1 program development cycle
Unit 1 program development cycle
 
Bootstrapping in Compiler
Bootstrapping in CompilerBootstrapping in Compiler
Bootstrapping in Compiler
 
Programming Paradigms
Programming ParadigmsProgramming Paradigms
Programming Paradigms
 
Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2Programming fundamentals lecture 1&2
Programming fundamentals lecture 1&2
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
 
Introduction to programming by MUFIX Commnity
Introduction to programming by MUFIX CommnityIntroduction to programming by MUFIX Commnity
Introduction to programming by MUFIX Commnity
 
Intro flash cards
Intro flash cardsIntro flash cards
Intro flash cards
 
Intro flash cards
Intro flash cardsIntro flash cards
Intro flash cards
 
Interpreted and compiled language
Interpreted and compiled languageInterpreted and compiled language
Interpreted and compiled language
 
Compiler design
Compiler designCompiler design
Compiler design
 
Unit 1
Unit 1Unit 1
Unit 1
 
Rsqrd AI: ML Tooling at an AI-first Startup
Rsqrd AI: ML Tooling at an AI-first StartupRsqrd AI: ML Tooling at an AI-first Startup
Rsqrd AI: ML Tooling at an AI-first Startup
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
2018-09 - F# and Fable
2018-09 - F# and Fable2018-09 - F# and Fable
2018-09 - F# and Fable
 
Beekman5 std ppt_13
Beekman5 std ppt_13Beekman5 std ppt_13
Beekman5 std ppt_13
 
Compilation v. interpretation
Compilation v. interpretationCompilation v. interpretation
Compilation v. interpretation
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
compiler vs interpreter
compiler vs interpretercompiler vs interpreter
compiler vs interpreter
 
Translators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreterTranslators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreter
 
Computer programming project 15sec
Computer programming project 15secComputer programming project 15sec
Computer programming project 15sec
 

Semelhante a Lecture 23 p1

Computer Programming In C.pptx
Computer Programming In C.pptxComputer Programming In C.pptx
Computer Programming In C.pptxchouguleamruta24
 
An Introduction To Python - Understanding Computers
An Introduction To Python - Understanding ComputersAn Introduction To Python - Understanding Computers
An Introduction To Python - Understanding ComputersBlue Elephant Consulting
 
fundamentalofcomputers-postaldeptt-150308230655-conversion-gate01.pdf
fundamentalofcomputers-postaldeptt-150308230655-conversion-gate01.pdffundamentalofcomputers-postaldeptt-150308230655-conversion-gate01.pdf
fundamentalofcomputers-postaldeptt-150308230655-conversion-gate01.pdfAlihaAzmat1
 
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...Abhishekn84
 
Computer organization basics
Computer organization  basicsComputer organization  basics
Computer organization basicsDeepak John
 
diploma basic of computers.ppt
diploma basic of computers.pptdiploma basic of computers.ppt
diploma basic of computers.pptLathaSrinivas5
 
Parallel Computing-Part-1.pptx
Parallel Computing-Part-1.pptxParallel Computing-Part-1.pptx
Parallel Computing-Part-1.pptxkrnaween
 
Unit-1_Digital Computers, number systemCOA[1].pptx
Unit-1_Digital Computers, number systemCOA[1].pptxUnit-1_Digital Computers, number systemCOA[1].pptx
Unit-1_Digital Computers, number systemCOA[1].pptxVanshJain322212
 
Computer Organisation unit 1 basics of computer Organisation
Computer Organisation unit 1 basics of computer OrganisationComputer Organisation unit 1 basics of computer Organisation
Computer Organisation unit 1 basics of computer Organisationluckyanirudhsai
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsAkhil Kaushik
 
Performance Tuning by Dijesh P
Performance Tuning by Dijesh PPerformance Tuning by Dijesh P
Performance Tuning by Dijesh PPlusOrMinusZero
 
Computer Fundamentals.pptx
Computer Fundamentals.pptxComputer Fundamentals.pptx
Computer Fundamentals.pptxJaimeCanchela1
 
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...LeahRachael
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory managementrprajat007
 
Programming for Problem Solving
Programming for Problem SolvingProgramming for Problem Solving
Programming for Problem SolvingSukhendra Singh
 

Semelhante a Lecture 23 p1 (20)

Cs 331 Data Structures
Cs 331 Data StructuresCs 331 Data Structures
Cs 331 Data Structures
 
Computer Programming In C.pptx
Computer Programming In C.pptxComputer Programming In C.pptx
Computer Programming In C.pptx
 
An Introduction To Python - Understanding Computers
An Introduction To Python - Understanding ComputersAn Introduction To Python - Understanding Computers
An Introduction To Python - Understanding Computers
 
Fundamental of Computers
Fundamental of ComputersFundamental of Computers
Fundamental of Computers
 
fundamentalofcomputers-postaldeptt-150308230655-conversion-gate01.pdf
fundamentalofcomputers-postaldeptt-150308230655-conversion-gate01.pdffundamentalofcomputers-postaldeptt-150308230655-conversion-gate01.pdf
fundamentalofcomputers-postaldeptt-150308230655-conversion-gate01.pdf
 
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
Basic Structure of Computers: Functional Units, Basic Operational Concepts, B...
 
Computer organization basics
Computer organization  basicsComputer organization  basics
Computer organization basics
 
diploma basic of computers.ppt
diploma basic of computers.pptdiploma basic of computers.ppt
diploma basic of computers.ppt
 
Parallel Computing-Part-1.pptx
Parallel Computing-Part-1.pptxParallel Computing-Part-1.pptx
Parallel Computing-Part-1.pptx
 
lec 1.pptx
lec 1.pptxlec 1.pptx
lec 1.pptx
 
Unit-1_Digital Computers, number systemCOA[1].pptx
Unit-1_Digital Computers, number systemCOA[1].pptxUnit-1_Digital Computers, number systemCOA[1].pptx
Unit-1_Digital Computers, number systemCOA[1].pptx
 
Computer Organisation unit 1 basics of computer Organisation
Computer Organisation unit 1 basics of computer OrganisationComputer Organisation unit 1 basics of computer Organisation
Computer Organisation unit 1 basics of computer Organisation
 
Intro to Data Structure & Algorithms
Intro to Data Structure & AlgorithmsIntro to Data Structure & Algorithms
Intro to Data Structure & Algorithms
 
Performance Tuning by Dijesh P
Performance Tuning by Dijesh PPerformance Tuning by Dijesh P
Performance Tuning by Dijesh P
 
Lecture1
Lecture1Lecture1
Lecture1
 
01CHAP_1.PPT
01CHAP_1.PPT01CHAP_1.PPT
01CHAP_1.PPT
 
Computer Fundamentals.pptx
Computer Fundamentals.pptxComputer Fundamentals.pptx
Computer Fundamentals.pptx
 
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
UNIT 3-EXPLAINING THE MEMORY MANAGEMENT LOGICAL AND AND PHYSICAL DATA FLOW DI...
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
 
Programming for Problem Solving
Programming for Problem SolvingProgramming for Problem Solving
Programming for Problem Solving
 

Mais de Skillspire LLC (20)

Logistics
LogisticsLogistics
Logistics
 
Introduction to analytics
Introduction to analyticsIntroduction to analytics
Introduction to analytics
 
Lecture 31
Lecture 31Lecture 31
Lecture 31
 
Lecture 30
Lecture 30Lecture 30
Lecture 30
 
Review
ReviewReview
Review
 
Review version 4
Review version 4Review version 4
Review version 4
 
Review version 3
Review version 3Review version 3
Review version 3
 
Review version 2
Review version 2Review version 2
Review version 2
 
Lecture 24
Lecture 24Lecture 24
Lecture 24
 
Lecture 17
Lecture 17Lecture 17
Lecture 17
 
Lecture 16
Lecture 16Lecture 16
Lecture 16
 
Lecture 15
Lecture 15Lecture 15
Lecture 15
 
Lecture 14
Lecture 14Lecture 14
Lecture 14
 
Lecture 14
Lecture 14Lecture 14
Lecture 14
 
Lecture 13
Lecture 13Lecture 13
Lecture 13
 
Lecture 12
Lecture 12Lecture 12
Lecture 12
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 

Último

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
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 ...EduSkills OECD
 
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 ImpactPECB
 
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 . pdfQucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 

Último (20)

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
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 ...
 
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
 
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
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 

Lecture 23 p1

  • 2.
  • 3. AGENDA • Memory • Garbage Collection • Big O Notation (Runtime) • Doubly LinkedLists
  • 5. WHAT IS MEMORY IN COMPUTER SCIENCE? • Memory is the area where the computer stores or remembers data. • Some types of computer memory are designed to be very fast, meaning that the central processing unit (CPU) can access data stored there very quickly. • Your computer's main memory is called RAM (Random Access Memory). • You can think of it as a workspace the computer uses to get work done. When you double- click on an app, or open a document, or, well, do much of anything, RAM gets used to store that data while the computer is working on it. • H
  • 6. WHY IS MEMORY IMPORTANT? • RAM allows your computer to perform many of its everyday tasks, such as loading applications, browsing the internet, editing a spreadsheet, or experiencing the latest game. • Memory also allows you to switch quickly among these tasks, remembering where you are in one task when you switch to another task. • It holds the data and instructions that the Central Processing Unit (CPU) needs • This allows the CPU direct access to the computer program. • Memory is needed in all computers
  • 7.
  • 9. WHAT IS GARBAGE COLLECTION? • The garbage collector (GC) manages the allocation and release of memory • When there isn't enough memory to allocate an object, the GC must collect and dispose of garbage memory to make memory available for new allocations. This process is known as garbage collection. • Garbage Collection in C# has the following advantages − • You don’t need to free memory manually while developing your application. • It also allocates objects on the managed heap efficiently. • When objects are no longer used then it will reclaim those objects by clearing their memory and keeps the memory available for future allocations. • Managed objects automatically get clean content to start with, so their constructors do not have to initialize every data field.
  • 10.
  • 11. BIG O NOTATION (RUNTIME)
  • 12. WHAT IS BIG O NOTATION? • Big O notation is used in Computer Science to describe the performance or complexity of an algorithm. • Big O specifically describes the worst-case scenario, and can be used to describe the execution time required or the space used (e.g. in memory or on disk) by an algorithm. • Big O notation is a measure of the complexity of your program in terms of the size of the input. • The size of the input is usually denote as ‘n’. There are usually 2 ways to measure the complexity: • Time: The number of calculations your program must perform on the input data to get the output. • For example finding the biggest number in a list of n numbers requires you to check every number against against your current maximum and see if the new number is higher. Thus for n numbers you need n checks, or calculations. This has linear time complexity because there is a 1 to 1 relationship between input the number of calculations to obtain the output. Linear time complexity is denoted as O(n). • Space: The amount of storage space needed by the program to run its calculations. • We will use the above example of finding the biggest number in a list of n numbers. We need a variable to store our current maximum number value. If we have 10 numbers, we need 1 variable, if we have a million numbers, we still need 1 variable. The number of variables we need is constant compared to the input size, so our program has constant space complexity, denoted as O(1).
  • 13. LIVE WALKTHRU/EXPLANATION • Write code for each of the runtimes discussed • Share out – the class will guess what runtime your code is displaying
  • 14.
  • 16. WHAT IS A DOUBLY LINKEDLIST? • In computer science, a doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains three fields: two link fields and one data field.
  • 17. THE DIFFERENCE BETWEEN A LINKEDLIST AND DOUBLY LINKEDLIST • A Doubly LinkedLists has references that goes both ways compared to a Singly LinkedList that has references pointing one way
  • 19.
  • 20.
  • 21. DISCUSSION • Why is this important? • How can this be useful to me? • How can I use this in my current job? • How can I use this in my future career? • What will I get out of this? • How is this used in the real world Regroup and discuss after…
  • 22.
  • 23. COMPLETE THE WORKSHEET WITH YOUR GROUP Regroup and discuss after…