SlideShare a Scribd company logo
A linked list is a linear data structure consisting of a set of nodes, where each one except the last
one points to the next node in the list. (Appendix A provides more information about linked
lists.) Suppose we have the set of 5 nodes shown in the illustration below. These nodes have
been scrambled up and placed in a MARIE program as shown below. Write a MARIE program
to traverse the list and print the data in order as stored in each node.
Solution
Address Label
(hex) JUMP start
00D Addr, Hex 0006 //Top of list pointer, address of node 1
00E Node2, Hex 0032 //Node data is the character 2.
00F Hex 0008 //address of node 3.
010 Node4, Hex 0034 //character "4".
011 Hex 000A //address of node 5
012 Node1, Hex 0031 //Character 1
013 Hex 0002 //address of node2
014 Node3 Hex 0033 //Character 3
015 Hex 0004 // addresss of node 4
016 Node5 Hex 0035 //Character 5
017 Hex 0000 //end of the list
Next Hex 0000 //pointer to next element
ONE Hex 0001 //one
Start LOAD Addr //LOAD LINK HEAD
STORE Next //
LOAD Next
Loop SKIPCOND 400 //if AC==0 - end of list reached
JUMP NextElem
JUMP End
NextElem CLEAR //Next is not null
ADDI Next // Load data value from current pointter to AC
OUTPUT // Display it
LOAD ONE // AC <-- 1
ADD Next // AC <--- Next+1 (pointer field address)
STORE Next // AC ---> Next
CLEAR // AC <---- 0
ADDI Next // AC <--[Next] (load next address from pointer field)
STORE Next // AC--> Next (Next loop)
JUMP Loop
End HALT

More Related Content

More from karymadelaneyrenne19

in the case of the Bacillis strain, why would a young culture be use.pdf
in the case of the Bacillis strain, why would a young culture be use.pdfin the case of the Bacillis strain, why would a young culture be use.pdf
in the case of the Bacillis strain, why would a young culture be use.pdf
karymadelaneyrenne19
 
In HTTP response headers, what is the syntax of most lines (which ar.pdf
In HTTP response headers, what is the syntax of most lines (which ar.pdfIn HTTP response headers, what is the syntax of most lines (which ar.pdf
In HTTP response headers, what is the syntax of most lines (which ar.pdf
karymadelaneyrenne19
 
How is the mouth of planaria similar to the proboscis of Nemertean.pdf
How is the mouth of planaria similar to the proboscis of Nemertean.pdfHow is the mouth of planaria similar to the proboscis of Nemertean.pdf
How is the mouth of planaria similar to the proboscis of Nemertean.pdf
karymadelaneyrenne19
 
How do you define a species for asexually reproducing organisms; orga.pdf
How do you define a species for asexually reproducing organisms; orga.pdfHow do you define a species for asexually reproducing organisms; orga.pdf
How do you define a species for asexually reproducing organisms; orga.pdf
karymadelaneyrenne19
 
How do cognitive changes contribute to decision-making during adoles.pdf
How do cognitive changes contribute to decision-making during adoles.pdfHow do cognitive changes contribute to decision-making during adoles.pdf
How do cognitive changes contribute to decision-making during adoles.pdf
karymadelaneyrenne19
 
Describe the various types of computer-based information systems in .pdf
Describe the various types of computer-based information systems in .pdfDescribe the various types of computer-based information systems in .pdf
Describe the various types of computer-based information systems in .pdf
karymadelaneyrenne19
 
Day care centers expose children to a wider variety of germs than th.pdf
Day care centers expose children to a wider variety of germs than th.pdfDay care centers expose children to a wider variety of germs than th.pdf
Day care centers expose children to a wider variety of germs than th.pdf
karymadelaneyrenne19
 
Consider a two-state paramagnet with a very large number N of elemen.pdf
Consider a two-state paramagnet with a very large number N of elemen.pdfConsider a two-state paramagnet with a very large number N of elemen.pdf
Consider a two-state paramagnet with a very large number N of elemen.pdf
karymadelaneyrenne19
 
An administrator wishes to force remote access users to connect usin.pdf
An administrator wishes to force remote access users to connect usin.pdfAn administrator wishes to force remote access users to connect usin.pdf
An administrator wishes to force remote access users to connect usin.pdf
karymadelaneyrenne19
 
Below is a quote from Bobby Kennedy on what the Gross National Produ.pdf
Below is a quote from Bobby Kennedy on what the Gross National Produ.pdfBelow is a quote from Bobby Kennedy on what the Gross National Produ.pdf
Below is a quote from Bobby Kennedy on what the Gross National Produ.pdf
karymadelaneyrenne19
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
karymadelaneyrenne19
 
Across the field of human development, “development” is defined as .pdf
Across the field of human development, “development” is defined as .pdfAcross the field of human development, “development” is defined as .pdf
Across the field of human development, “development” is defined as .pdf
karymadelaneyrenne19
 
12. The white “Spirit” black bear, Ursys anerucabys kermodei, differ.pdf
12. The white “Spirit” black bear, Ursys anerucabys kermodei, differ.pdf12. The white “Spirit” black bear, Ursys anerucabys kermodei, differ.pdf
12. The white “Spirit” black bear, Ursys anerucabys kermodei, differ.pdf
karymadelaneyrenne19
 
With respect to the study of lawWhat is the purpose of discovery.pdf
With respect to the study of lawWhat is the purpose of discovery.pdfWith respect to the study of lawWhat is the purpose of discovery.pdf
With respect to the study of lawWhat is the purpose of discovery.pdf
karymadelaneyrenne19
 
Why do you need proteins to allow ions to cross the cell membrane an.pdf
Why do you need proteins to allow ions to cross the cell membrane an.pdfWhy do you need proteins to allow ions to cross the cell membrane an.pdf
Why do you need proteins to allow ions to cross the cell membrane an.pdf
karymadelaneyrenne19
 
When you digest a sample of your protein with Chymotrypsin you get a.pdf
When you digest a sample of your protein with Chymotrypsin you get a.pdfWhen you digest a sample of your protein with Chymotrypsin you get a.pdf
When you digest a sample of your protein with Chymotrypsin you get a.pdf
karymadelaneyrenne19
 
What type of rock can be dated with radiometric methodsSolution.pdf
What type of rock can be dated with radiometric methodsSolution.pdfWhat type of rock can be dated with radiometric methodsSolution.pdf
What type of rock can be dated with radiometric methodsSolution.pdf
karymadelaneyrenne19
 
What isSuperfortressand the Flying Fortress their roles in recen.pdf
What isSuperfortressand the Flying Fortress their roles in recen.pdfWhat isSuperfortressand the Flying Fortress their roles in recen.pdf
What isSuperfortressand the Flying Fortress their roles in recen.pdf
karymadelaneyrenne19
 
Volvox was formerly classified as a complex colony, but now scientist.pdf
Volvox was formerly classified as a complex colony, but now scientist.pdfVolvox was formerly classified as a complex colony, but now scientist.pdf
Volvox was formerly classified as a complex colony, but now scientist.pdf
karymadelaneyrenne19
 
Using netbeans javaThe purpose of this exercise is t.pdf
Using netbeans javaThe purpose of this exercise is t.pdfUsing netbeans javaThe purpose of this exercise is t.pdf
Using netbeans javaThe purpose of this exercise is t.pdf
karymadelaneyrenne19
 

More from karymadelaneyrenne19 (20)

in the case of the Bacillis strain, why would a young culture be use.pdf
in the case of the Bacillis strain, why would a young culture be use.pdfin the case of the Bacillis strain, why would a young culture be use.pdf
in the case of the Bacillis strain, why would a young culture be use.pdf
 
In HTTP response headers, what is the syntax of most lines (which ar.pdf
In HTTP response headers, what is the syntax of most lines (which ar.pdfIn HTTP response headers, what is the syntax of most lines (which ar.pdf
In HTTP response headers, what is the syntax of most lines (which ar.pdf
 
How is the mouth of planaria similar to the proboscis of Nemertean.pdf
How is the mouth of planaria similar to the proboscis of Nemertean.pdfHow is the mouth of planaria similar to the proboscis of Nemertean.pdf
How is the mouth of planaria similar to the proboscis of Nemertean.pdf
 
How do you define a species for asexually reproducing organisms; orga.pdf
How do you define a species for asexually reproducing organisms; orga.pdfHow do you define a species for asexually reproducing organisms; orga.pdf
How do you define a species for asexually reproducing organisms; orga.pdf
 
How do cognitive changes contribute to decision-making during adoles.pdf
How do cognitive changes contribute to decision-making during adoles.pdfHow do cognitive changes contribute to decision-making during adoles.pdf
How do cognitive changes contribute to decision-making during adoles.pdf
 
Describe the various types of computer-based information systems in .pdf
Describe the various types of computer-based information systems in .pdfDescribe the various types of computer-based information systems in .pdf
Describe the various types of computer-based information systems in .pdf
 
Day care centers expose children to a wider variety of germs than th.pdf
Day care centers expose children to a wider variety of germs than th.pdfDay care centers expose children to a wider variety of germs than th.pdf
Day care centers expose children to a wider variety of germs than th.pdf
 
Consider a two-state paramagnet with a very large number N of elemen.pdf
Consider a two-state paramagnet with a very large number N of elemen.pdfConsider a two-state paramagnet with a very large number N of elemen.pdf
Consider a two-state paramagnet with a very large number N of elemen.pdf
 
An administrator wishes to force remote access users to connect usin.pdf
An administrator wishes to force remote access users to connect usin.pdfAn administrator wishes to force remote access users to connect usin.pdf
An administrator wishes to force remote access users to connect usin.pdf
 
Below is a quote from Bobby Kennedy on what the Gross National Produ.pdf
Below is a quote from Bobby Kennedy on what the Gross National Produ.pdfBelow is a quote from Bobby Kennedy on what the Gross National Produ.pdf
Below is a quote from Bobby Kennedy on what the Gross National Produ.pdf
 
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdfAbstract Data Types (a) Explain briefly what is meant by the ter.pdf
Abstract Data Types (a) Explain briefly what is meant by the ter.pdf
 
Across the field of human development, “development” is defined as .pdf
Across the field of human development, “development” is defined as .pdfAcross the field of human development, “development” is defined as .pdf
Across the field of human development, “development” is defined as .pdf
 
12. The white “Spirit” black bear, Ursys anerucabys kermodei, differ.pdf
12. The white “Spirit” black bear, Ursys anerucabys kermodei, differ.pdf12. The white “Spirit” black bear, Ursys anerucabys kermodei, differ.pdf
12. The white “Spirit” black bear, Ursys anerucabys kermodei, differ.pdf
 
With respect to the study of lawWhat is the purpose of discovery.pdf
With respect to the study of lawWhat is the purpose of discovery.pdfWith respect to the study of lawWhat is the purpose of discovery.pdf
With respect to the study of lawWhat is the purpose of discovery.pdf
 
Why do you need proteins to allow ions to cross the cell membrane an.pdf
Why do you need proteins to allow ions to cross the cell membrane an.pdfWhy do you need proteins to allow ions to cross the cell membrane an.pdf
Why do you need proteins to allow ions to cross the cell membrane an.pdf
 
When you digest a sample of your protein with Chymotrypsin you get a.pdf
When you digest a sample of your protein with Chymotrypsin you get a.pdfWhen you digest a sample of your protein with Chymotrypsin you get a.pdf
When you digest a sample of your protein with Chymotrypsin you get a.pdf
 
What type of rock can be dated with radiometric methodsSolution.pdf
What type of rock can be dated with radiometric methodsSolution.pdfWhat type of rock can be dated with radiometric methodsSolution.pdf
What type of rock can be dated with radiometric methodsSolution.pdf
 
What isSuperfortressand the Flying Fortress their roles in recen.pdf
What isSuperfortressand the Flying Fortress their roles in recen.pdfWhat isSuperfortressand the Flying Fortress their roles in recen.pdf
What isSuperfortressand the Flying Fortress their roles in recen.pdf
 
Volvox was formerly classified as a complex colony, but now scientist.pdf
Volvox was formerly classified as a complex colony, but now scientist.pdfVolvox was formerly classified as a complex colony, but now scientist.pdf
Volvox was formerly classified as a complex colony, but now scientist.pdf
 
Using netbeans javaThe purpose of this exercise is t.pdf
Using netbeans javaThe purpose of this exercise is t.pdfUsing netbeans javaThe purpose of this exercise is t.pdf
Using netbeans javaThe purpose of this exercise is t.pdf
 

Recently uploaded

The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 

Recently uploaded (20)

The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 

A linked list is a linear data structure consisting of a set of nodes.pdf

  • 1. A linked list is a linear data structure consisting of a set of nodes, where each one except the last one points to the next node in the list. (Appendix A provides more information about linked lists.) Suppose we have the set of 5 nodes shown in the illustration below. These nodes have been scrambled up and placed in a MARIE program as shown below. Write a MARIE program to traverse the list and print the data in order as stored in each node. Solution Address Label (hex) JUMP start 00D Addr, Hex 0006 //Top of list pointer, address of node 1 00E Node2, Hex 0032 //Node data is the character 2. 00F Hex 0008 //address of node 3. 010 Node4, Hex 0034 //character "4". 011 Hex 000A //address of node 5 012 Node1, Hex 0031 //Character 1 013 Hex 0002 //address of node2 014 Node3 Hex 0033 //Character 3 015 Hex 0004 // addresss of node 4 016 Node5 Hex 0035 //Character 5 017 Hex 0000 //end of the list Next Hex 0000 //pointer to next element ONE Hex 0001 //one Start LOAD Addr //LOAD LINK HEAD STORE Next // LOAD Next Loop SKIPCOND 400 //if AC==0 - end of list reached JUMP NextElem JUMP End NextElem CLEAR //Next is not null ADDI Next // Load data value from current pointter to AC OUTPUT // Display it LOAD ONE // AC <-- 1 ADD Next // AC <--- Next+1 (pointer field address) STORE Next // AC ---> Next CLEAR // AC <---- 0
  • 2. ADDI Next // AC <--[Next] (load next address from pointer field) STORE Next // AC--> Next (Next loop) JUMP Loop End HALT