SlideShare uma empresa Scribd logo
1 de 5
Baixar para ler offline
Arrays, Linked List, Stack and Queues


What are array, linked list, stack and queues? What is the concept behind
stack and queues? What is the requirement of stack and queues. If we have
arrays for the concept of list then how come we require linked list. How
linked list is more advantageous than array?


These are some of the questions come into a students mind when the concept
of stack and linked list is introduced to them. It’s really a big deal to make
this concept clear to each and every student of the class. Ask a student and
they will say “The most difficult chapter is array, linked list, stack and
queues, I could not understand it.”


I tried a lot to make this concept clear to the students using power point
slides, diagrams and animations present on the Internet but then only I was
not satisfied. As the diagrams, the animation, power point slides were
helping to understand one or the other concept related to Arrays, linked list,
stack and queues at a time but not a clear picture of overall basic concept of
Arrays, linked list, stack and queues. Some of the questions asked by the
students were remain unanswered with the help of power point or other
technological tool. I was searching for better way to make students
understand about the concept.


In one of my class on linked list, it just struck to my mind and I took
example of students sitting in a row in the class. Just that !!!!!!!!!!!

To my surprise, all the questions asked by the students got answers using
this example. In this batch of XII class, now nobody says that we don’t
know the concept of arrays, linked list, stack and queues. They are satisfied
and moreover I am satisfied this way of teaching arrays, linked list stack and
queues.
Arrays and linked list are data structures used to represent list in C++
programming.

Arrays allocate contiguous memory but linked list has non contiguous
memory allocation
To make this concept clear, I ask a whole row of the students in the class to
stand up and showed the students that this is the concept of array where
every item has to be adjacent to each other at one place that is contiguous
memory allocation

Then I ask some of the students from the class to stand up haphazardly from
different rows and told them to call the name of the student given to them by
me. Like ‘A’ student from row1 will call the name of ‘B’ student in row2
then B student will call the name of ‘C’ student in row4 and so on. Then I
told them this is the concept of linked list where items of the list don’t need
to be at one place and there are join with pointers where pointers have the
address of next item in the linked list as here each student has the name of
next student they have to call.

                ROW1    ROW2     ROW3      ROW4

                                             *
                                             *
                                             *
                                             *
                                             *


                ROW1    ROW2     ROW3      ROW4



                                             C
                 A


                          B
If array is there than what is the need of linked list?
Array is static in nature and linked list is dynamic in nature.
To make this concept clear to them, again I make students of a row1 to stand
up and ask a student of row2 to come and sit in row1 which is fully filled.
He was not able to sit as there was no space. This is the concept of array if
there is a space for 5 items then we can’t increase the space as per our
requirement at run time. That is array is static in nature
Then I again make students stand haphazardly and told them the names of
next student. I ask that student from row2 to now sit on any other empty seat
in the class. Those student who were standing, I told to the last student (who
has not called any other student) to call the name of the student who has just
be seated from row2 to any other empty seat. This is the concept of linked
list where new item got the space as per the requirement and linked to the
linked list by pointers. Linked list is dynamic in nature.


               ROW1     ROW2     ROW3      ROW4

                 *      &

                 *      &

                 *      &

                 *      &

                 *
     &    No Space


                ROW1    ROW2     ROW3      ROW4



                                             C
                 A


                         B         &
      & got the space
Stack has the concept of Last in first out (LIFO)
Stack is a concept where the item last entered is deleted first.
To make this concept of stack clear I told the student to sit in a row one by
one. Then ask the last student who sat in a row to stand up and come out of
the row. Then again ask the second last student to come out. This is the
concept of Last in First out in a stack. Stack can be implemented both using
arrays and linked list.

             ROW1     ROW2    ROW3       ROW4


               *
               *
               *
    *
    *
Deleted




               ROW1    ROW2     ROW3      ROW4



                                            C
                A


                         B           &



            & C Deleted
Queue has the concept of First in first out (FIFO)
Queue is a concept where the item first entered is deleted first.
To make this concept clear I told the students to sit in a row one by one. I
ask first student of the row to stand up and come out. Then again I ask next
first student of the row to stand up and come out. This is the concept of First
in first out in a queue. Queue can be implemented both using arrays and
linked list




               ROW1     ROW2     ROW3      ROW4




                  *
*                 *
*                 *
Deleted




                ROW1    ROW2     ROW3      ROW4



                                             C




                                   &
      A Deleted
      B Deleted
                                                           Submitted by :
                                                               Ms. Isha Bhatia,
                                                            PGT Computer Sc.
                                                   Kendriya Vidyalaya Pitampura

Mais conteúdo relacionado

Último

4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptxiammrhaywood
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsManeerUddin
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 

Último (20)

4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptxAUDIENCE THEORY -CULTIVATION THEORY -  GERBNER.pptx
AUDIENCE THEORY -CULTIVATION THEORY - GERBNER.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture hons
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 

Destaque

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
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 2024Albert 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 InsightsKurio // 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 2024Search 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 summarySpeakerHub
 
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 IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit 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 managementMindGenius
 
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 WorkGetSmarter
 

Destaque (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
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
 

Understanding Arrays, Linked Lists, Stacks and Queues with Real-World Examples

  • 1. Arrays, Linked List, Stack and Queues What are array, linked list, stack and queues? What is the concept behind stack and queues? What is the requirement of stack and queues. If we have arrays for the concept of list then how come we require linked list. How linked list is more advantageous than array? These are some of the questions come into a students mind when the concept of stack and linked list is introduced to them. It’s really a big deal to make this concept clear to each and every student of the class. Ask a student and they will say “The most difficult chapter is array, linked list, stack and queues, I could not understand it.” I tried a lot to make this concept clear to the students using power point slides, diagrams and animations present on the Internet but then only I was not satisfied. As the diagrams, the animation, power point slides were helping to understand one or the other concept related to Arrays, linked list, stack and queues at a time but not a clear picture of overall basic concept of Arrays, linked list, stack and queues. Some of the questions asked by the students were remain unanswered with the help of power point or other technological tool. I was searching for better way to make students understand about the concept. In one of my class on linked list, it just struck to my mind and I took example of students sitting in a row in the class. Just that !!!!!!!!!!! To my surprise, all the questions asked by the students got answers using this example. In this batch of XII class, now nobody says that we don’t know the concept of arrays, linked list, stack and queues. They are satisfied and moreover I am satisfied this way of teaching arrays, linked list stack and queues.
  • 2. Arrays and linked list are data structures used to represent list in C++ programming. Arrays allocate contiguous memory but linked list has non contiguous memory allocation To make this concept clear, I ask a whole row of the students in the class to stand up and showed the students that this is the concept of array where every item has to be adjacent to each other at one place that is contiguous memory allocation Then I ask some of the students from the class to stand up haphazardly from different rows and told them to call the name of the student given to them by me. Like ‘A’ student from row1 will call the name of ‘B’ student in row2 then B student will call the name of ‘C’ student in row4 and so on. Then I told them this is the concept of linked list where items of the list don’t need to be at one place and there are join with pointers where pointers have the address of next item in the linked list as here each student has the name of next student they have to call. ROW1 ROW2 ROW3 ROW4 * * * * * ROW1 ROW2 ROW3 ROW4 C A B
  • 3. If array is there than what is the need of linked list? Array is static in nature and linked list is dynamic in nature. To make this concept clear to them, again I make students of a row1 to stand up and ask a student of row2 to come and sit in row1 which is fully filled. He was not able to sit as there was no space. This is the concept of array if there is a space for 5 items then we can’t increase the space as per our requirement at run time. That is array is static in nature Then I again make students stand haphazardly and told them the names of next student. I ask that student from row2 to now sit on any other empty seat in the class. Those student who were standing, I told to the last student (who has not called any other student) to call the name of the student who has just be seated from row2 to any other empty seat. This is the concept of linked list where new item got the space as per the requirement and linked to the linked list by pointers. Linked list is dynamic in nature. ROW1 ROW2 ROW3 ROW4 * & * & * & * & * & No Space ROW1 ROW2 ROW3 ROW4 C A B & & got the space
  • 4. Stack has the concept of Last in first out (LIFO) Stack is a concept where the item last entered is deleted first. To make this concept of stack clear I told the student to sit in a row one by one. Then ask the last student who sat in a row to stand up and come out of the row. Then again ask the second last student to come out. This is the concept of Last in First out in a stack. Stack can be implemented both using arrays and linked list. ROW1 ROW2 ROW3 ROW4 * * * * * Deleted ROW1 ROW2 ROW3 ROW4 C A B & & C Deleted
  • 5. Queue has the concept of First in first out (FIFO) Queue is a concept where the item first entered is deleted first. To make this concept clear I told the students to sit in a row one by one. I ask first student of the row to stand up and come out. Then again I ask next first student of the row to stand up and come out. This is the concept of First in first out in a queue. Queue can be implemented both using arrays and linked list ROW1 ROW2 ROW3 ROW4 * * * * * Deleted ROW1 ROW2 ROW3 ROW4 C & A Deleted B Deleted Submitted by : Ms. Isha Bhatia, PGT Computer Sc. Kendriya Vidyalaya Pitampura