SlideShare a Scribd company logo
1 of 4
Take the following C code. ( see file fib.c )
1.)
Compile it and get results.
2.)
Convert C code to MIPS.
3.)
Using SPIM report on register step by stem using snip/or cut
and copy screen shots.
CODE:
/* File: count_sort.c
* Purpose: Implement count sort of a list of ints
*
* Compile: gcc -g -Wall -o count_sort count_sort.c
* Run: ./count_sort
*
* Input: n (number of elements)
* elements of list
* Output: sorted list
*
* Note: List is statically allocated. Recompile if n > 100
*/
#include
#include
#define MAX 100
void Read_list(int list[], int n);
void Count_sort(int list[], int n);
int Fnd_pos(int val, int i, int list[], int n);
void Copy_list(int new_list[], int list[], int n);
void Print_list(int list[], int n);
int main(void) {
int list[MAX], n;
scanf("%d", &n);
Read_list(list, n);
// Print_list(list, n);
Count_sort(list, n);
Print_list(list, n);
return 0;
} /* main */
void Read_list(int list[], int n) {
int i;
for (i = 0; i < n; i++)
scanf("%d", &list[i]);
} /* Read_list */
/* Sort list of n elements by "counting"
* number of elements less than each element,
* and using the count as the subscript in
* a new list
*/
void Count_sort(int list[], int n) {
int i, loc, new_list[MAX];
for (i = 0; i < n; i++) {
loc = Fnd_pos(list[i], i, list, n);
new_list[loc] = list[i];
}
Copy_list(new_list, list, n);
} /* Count_sort */
/* Find the position to insert val among the elements
* in list by counting the number of elements "less than"
* val. In the case of a tie, an element list[j] is
* considered "less than" val if j < i.
*/
int Fnd_pos(int val, int i, int list[], int n) {
int j, count = 0;
for (j = 0; j < n; j++)
if (list[j] < val)
count++;
else if (list[j] == val && j < i)
count++;
return count;
} /* Fnd_pos */
/* Copy contents of new_list into list. Both store
* n elements
*/
void Copy_list(int new_list[], int list[], int n) {
int i;
for (i = 0; i < n; i++)
list[i] = new_list[i];
} /* Copy_list */
void Print_list(int list[], int n) {
int i;
for (i = 0; i < n; i++)
printf("%d ", list[i]);
printf("n");
} /* Print_list */

More Related Content

Similar to Take the following C code. (  see  file fib.c )1.)Compile .docx

The Ring programming language version 1.6 book - Part 84 of 189
The Ring programming language version 1.6 book - Part 84 of 189The Ring programming language version 1.6 book - Part 84 of 189
The Ring programming language version 1.6 book - Part 84 of 189Mahmoud Samir Fayed
 
Need to be done in C++ Please Sorted number list implementation wit.pdf
Need to be done in C++  Please   Sorted number list implementation wit.pdfNeed to be done in C++  Please   Sorted number list implementation wit.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdfaathiauto
 
Need to be done in C Please Sorted number list implementation with.pdf
Need to be done in C  Please   Sorted number list implementation with.pdfNeed to be done in C  Please   Sorted number list implementation with.pdf
Need to be done in C Please Sorted number list implementation with.pdfaathmaproducts
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxDIPESH30
 
C code on linked list #include stdio.h #include stdlib.h.pdf
 C code on linked list #include stdio.h #include stdlib.h.pdf C code on linked list #include stdio.h #include stdlib.h.pdf
C code on linked list #include stdio.h #include stdlib.h.pdfdeepua8
 
Implement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdfImplement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdfpetercoiffeur18
 
IN C CODEGiven an IntNode struct and the operating functions for a.pdf
IN C CODEGiven an IntNode struct and the operating functions for a.pdfIN C CODEGiven an IntNode struct and the operating functions for a.pdf
IN C CODEGiven an IntNode struct and the operating functions for a.pdfsiva009113
 
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfC++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfpoblettesedanoree498
 
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdfNeed done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdfinfo114
 
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdfarihantelehyb
 
Please help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdfPlease help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdfankit11134
 
Write a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfWrite a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfJUSTSTYLISH3B2MOHALI
 
The Ring programming language version 1.10 book - Part 96 of 212
The Ring programming language version 1.10 book - Part 96 of 212The Ring programming language version 1.10 book - Part 96 of 212
The Ring programming language version 1.10 book - Part 96 of 212Mahmoud Samir Fayed
 
Cheatsheet_Python.pdf
Cheatsheet_Python.pdfCheatsheet_Python.pdf
Cheatsheet_Python.pdfRamyaR163211
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdffortmdu
 
Given an IntNode struct and the operating functions for a linked list-.pdf
Given an IntNode struct and the operating functions for a linked list-.pdfGiven an IntNode struct and the operating functions for a linked list-.pdf
Given an IntNode struct and the operating functions for a linked list-.pdfNicholasflqStewartl
 
pleaase I want manual solution forData Structures and Algorithm An.pdf
pleaase I want manual solution forData Structures and Algorithm An.pdfpleaase I want manual solution forData Structures and Algorithm An.pdf
pleaase I want manual solution forData Structures and Algorithm An.pdfwasemanivytreenrco51
 

Similar to Take the following C code. (  see  file fib.c )1.)Compile .docx (20)

The Ring programming language version 1.6 book - Part 84 of 189
The Ring programming language version 1.6 book - Part 84 of 189The Ring programming language version 1.6 book - Part 84 of 189
The Ring programming language version 1.6 book - Part 84 of 189
 
Need to be done in C++ Please Sorted number list implementation wit.pdf
Need to be done in C++  Please   Sorted number list implementation wit.pdfNeed to be done in C++  Please   Sorted number list implementation wit.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdf
 
Need to be done in C Please Sorted number list implementation with.pdf
Need to be done in C  Please   Sorted number list implementation with.pdfNeed to be done in C  Please   Sorted number list implementation with.pdf
Need to be done in C Please Sorted number list implementation with.pdf
 
week-20x
week-20xweek-20x
week-20x
 
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docxlab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
 
C code on linked list #include stdio.h #include stdlib.h.pdf
 C code on linked list #include stdio.h #include stdlib.h.pdf C code on linked list #include stdio.h #include stdlib.h.pdf
C code on linked list #include stdio.h #include stdlib.h.pdf
 
DS Code (CWH).docx
DS Code (CWH).docxDS Code (CWH).docx
DS Code (CWH).docx
 
Implement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdfImplement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdf
 
IN C CODEGiven an IntNode struct and the operating functions for a.pdf
IN C CODEGiven an IntNode struct and the operating functions for a.pdfIN C CODEGiven an IntNode struct and the operating functions for a.pdf
IN C CODEGiven an IntNode struct and the operating functions for a.pdf
 
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdfC++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
C++ Doubly-Linked ListsThe goal of the exercise is to implement a.pdf
 
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdfNeed done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
Need done for Date Structures please! 4-18 LAB- Sorted number list imp.pdf
 
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
(Parent reference for BST) Redefine TreeNode by adding a reference to.pdf
 
Please help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdfPlease help solve this in C++ So the program is working fin.pdf
Please help solve this in C++ So the program is working fin.pdf
 
Write a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdfWrite a program that accepts an arithmetic expression of unsigned in.pdf
Write a program that accepts an arithmetic expression of unsigned in.pdf
 
Adt of lists
Adt of listsAdt of lists
Adt of lists
 
The Ring programming language version 1.10 book - Part 96 of 212
The Ring programming language version 1.10 book - Part 96 of 212The Ring programming language version 1.10 book - Part 96 of 212
The Ring programming language version 1.10 book - Part 96 of 212
 
Cheatsheet_Python.pdf
Cheatsheet_Python.pdfCheatsheet_Python.pdf
Cheatsheet_Python.pdf
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
 
Given an IntNode struct and the operating functions for a linked list-.pdf
Given an IntNode struct and the operating functions for a linked list-.pdfGiven an IntNode struct and the operating functions for a linked list-.pdf
Given an IntNode struct and the operating functions for a linked list-.pdf
 
pleaase I want manual solution forData Structures and Algorithm An.pdf
pleaase I want manual solution forData Structures and Algorithm An.pdfpleaase I want manual solution forData Structures and Algorithm An.pdf
pleaase I want manual solution forData Structures and Algorithm An.pdf
 

More from SANSKAR20

The Assignment (3–5 pages)Complete a leadership development plan .docx
The Assignment (3–5 pages)Complete a leadership development plan .docxThe Assignment (3–5 pages)Complete a leadership development plan .docx
The Assignment (3–5 pages)Complete a leadership development plan .docxSANSKAR20
 
The assignment consist of a Case Study.  I have attached the Case St.docx
The assignment consist of a Case Study.  I have attached the Case St.docxThe assignment consist of a Case Study.  I have attached the Case St.docx
The assignment consist of a Case Study.  I have attached the Case St.docxSANSKAR20
 
The annotated bibliography will present an introduction and five ref.docx
The annotated bibliography will present an introduction and five ref.docxThe annotated bibliography will present an introduction and five ref.docx
The annotated bibliography will present an introduction and five ref.docxSANSKAR20
 
The artist Georges Seurat is one of the worlds most fascinating art.docx
The artist Georges Seurat is one of the worlds most fascinating art.docxThe artist Georges Seurat is one of the worlds most fascinating art.docx
The artist Georges Seurat is one of the worlds most fascinating art.docxSANSKAR20
 
The Assignment (2–3 pages including a budget worksheet)Explain th.docx
The Assignment (2–3 pages including a budget worksheet)Explain th.docxThe Assignment (2–3 pages including a budget worksheet)Explain th.docx
The Assignment (2–3 pages including a budget worksheet)Explain th.docxSANSKAR20
 
The assigment is to Research and find me resources on  Portland Sta.docx
The assigment is to Research and find me resources on  Portland Sta.docxThe assigment is to Research and find me resources on  Portland Sta.docx
The assigment is to Research and find me resources on  Portland Sta.docxSANSKAR20
 
the article.httpwww.nytimes.com20120930opinionsundaythe-m.docx
the article.httpwww.nytimes.com20120930opinionsundaythe-m.docxthe article.httpwww.nytimes.com20120930opinionsundaythe-m.docx
the article.httpwww.nytimes.com20120930opinionsundaythe-m.docxSANSKAR20
 
The Arts and Royalty; Philosophers Debate Politics Please respond .docx
The Arts and Royalty; Philosophers Debate Politics Please respond .docxThe Arts and Royalty; Philosophers Debate Politics Please respond .docx
The Arts and Royalty; Philosophers Debate Politics Please respond .docxSANSKAR20
 
The assassination of Archduke Franz Ferdinand was the immediate caus.docx
The assassination of Archduke Franz Ferdinand was the immediate caus.docxThe assassination of Archduke Franz Ferdinand was the immediate caus.docx
The assassination of Archduke Franz Ferdinand was the immediate caus.docxSANSKAR20
 
The article Fostering Second Language Development in Young Children.docx
The article Fostering Second Language Development in Young Children.docxThe article Fostering Second Language Development in Young Children.docx
The article Fostering Second Language Development in Young Children.docxSANSKAR20
 
The Article Critique is required to be a minimum of two pages to a m.docx
The Article Critique is required to be a minimum of two pages to a m.docxThe Article Critique is required to be a minimum of two pages to a m.docx
The Article Critique is required to be a minimum of two pages to a m.docxSANSKAR20
 
The Apple Computer Company is one of the most innovative technology .docx
The Apple Computer Company is one of the most innovative technology .docxThe Apple Computer Company is one of the most innovative technology .docx
The Apple Computer Company is one of the most innovative technology .docxSANSKAR20
 
The artist Georges Seurat is one of the worlds most fascinating art.docx
The artist Georges Seurat is one of the worlds most fascinating art.docxThe artist Georges Seurat is one of the worlds most fascinating art.docx
The artist Georges Seurat is one of the worlds most fascinating art.docxSANSKAR20
 
The Article Attached A Bretton Woods for InnovationBy St.docx
The Article Attached A Bretton Woods for InnovationBy St.docxThe Article Attached A Bretton Woods for InnovationBy St.docx
The Article Attached A Bretton Woods for InnovationBy St.docxSANSKAR20
 
The analysis must includeExecutive summaryHistory and evolution.docx
The analysis must includeExecutive summaryHistory and evolution.docxThe analysis must includeExecutive summaryHistory and evolution.docx
The analysis must includeExecutive summaryHistory and evolution.docxSANSKAR20
 
The annotated bibliography for your course is now due. The annotated.docx
The annotated bibliography for your course is now due. The annotated.docxThe annotated bibliography for your course is now due. The annotated.docx
The annotated bibliography for your course is now due. The annotated.docxSANSKAR20
 
The Americans With Disabilities Act (ADA) was designed to protect wo.docx
The Americans With Disabilities Act (ADA) was designed to protect wo.docxThe Americans With Disabilities Act (ADA) was designed to protect wo.docx
The Americans With Disabilities Act (ADA) was designed to protect wo.docxSANSKAR20
 
The air they have of person who never knew how it felt to stand in .docx
The air they have of person who never knew how it felt to stand in .docxThe air they have of person who never knew how it felt to stand in .docx
The air they have of person who never knew how it felt to stand in .docxSANSKAR20
 
The agreement is for the tutor to write a Microsoft word doc of a .docx
The agreement is for the tutor to write a Microsoft word doc of a .docxThe agreement is for the tutor to write a Microsoft word doc of a .docx
The agreement is for the tutor to write a Microsoft word doc of a .docxSANSKAR20
 
The abstract is a 150-250 word summary of your Research Paper, and i.docx
The abstract is a 150-250 word summary of your Research Paper, and i.docxThe abstract is a 150-250 word summary of your Research Paper, and i.docx
The abstract is a 150-250 word summary of your Research Paper, and i.docxSANSKAR20
 

More from SANSKAR20 (20)

The Assignment (3–5 pages)Complete a leadership development plan .docx
The Assignment (3–5 pages)Complete a leadership development plan .docxThe Assignment (3–5 pages)Complete a leadership development plan .docx
The Assignment (3–5 pages)Complete a leadership development plan .docx
 
The assignment consist of a Case Study.  I have attached the Case St.docx
The assignment consist of a Case Study.  I have attached the Case St.docxThe assignment consist of a Case Study.  I have attached the Case St.docx
The assignment consist of a Case Study.  I have attached the Case St.docx
 
The annotated bibliography will present an introduction and five ref.docx
The annotated bibliography will present an introduction and five ref.docxThe annotated bibliography will present an introduction and five ref.docx
The annotated bibliography will present an introduction and five ref.docx
 
The artist Georges Seurat is one of the worlds most fascinating art.docx
The artist Georges Seurat is one of the worlds most fascinating art.docxThe artist Georges Seurat is one of the worlds most fascinating art.docx
The artist Georges Seurat is one of the worlds most fascinating art.docx
 
The Assignment (2–3 pages including a budget worksheet)Explain th.docx
The Assignment (2–3 pages including a budget worksheet)Explain th.docxThe Assignment (2–3 pages including a budget worksheet)Explain th.docx
The Assignment (2–3 pages including a budget worksheet)Explain th.docx
 
The assigment is to Research and find me resources on  Portland Sta.docx
The assigment is to Research and find me resources on  Portland Sta.docxThe assigment is to Research and find me resources on  Portland Sta.docx
The assigment is to Research and find me resources on  Portland Sta.docx
 
the article.httpwww.nytimes.com20120930opinionsundaythe-m.docx
the article.httpwww.nytimes.com20120930opinionsundaythe-m.docxthe article.httpwww.nytimes.com20120930opinionsundaythe-m.docx
the article.httpwww.nytimes.com20120930opinionsundaythe-m.docx
 
The Arts and Royalty; Philosophers Debate Politics Please respond .docx
The Arts and Royalty; Philosophers Debate Politics Please respond .docxThe Arts and Royalty; Philosophers Debate Politics Please respond .docx
The Arts and Royalty; Philosophers Debate Politics Please respond .docx
 
The assassination of Archduke Franz Ferdinand was the immediate caus.docx
The assassination of Archduke Franz Ferdinand was the immediate caus.docxThe assassination of Archduke Franz Ferdinand was the immediate caus.docx
The assassination of Archduke Franz Ferdinand was the immediate caus.docx
 
The article Fostering Second Language Development in Young Children.docx
The article Fostering Second Language Development in Young Children.docxThe article Fostering Second Language Development in Young Children.docx
The article Fostering Second Language Development in Young Children.docx
 
The Article Critique is required to be a minimum of two pages to a m.docx
The Article Critique is required to be a minimum of two pages to a m.docxThe Article Critique is required to be a minimum of two pages to a m.docx
The Article Critique is required to be a minimum of two pages to a m.docx
 
The Apple Computer Company is one of the most innovative technology .docx
The Apple Computer Company is one of the most innovative technology .docxThe Apple Computer Company is one of the most innovative technology .docx
The Apple Computer Company is one of the most innovative technology .docx
 
The artist Georges Seurat is one of the worlds most fascinating art.docx
The artist Georges Seurat is one of the worlds most fascinating art.docxThe artist Georges Seurat is one of the worlds most fascinating art.docx
The artist Georges Seurat is one of the worlds most fascinating art.docx
 
The Article Attached A Bretton Woods for InnovationBy St.docx
The Article Attached A Bretton Woods for InnovationBy St.docxThe Article Attached A Bretton Woods for InnovationBy St.docx
The Article Attached A Bretton Woods for InnovationBy St.docx
 
The analysis must includeExecutive summaryHistory and evolution.docx
The analysis must includeExecutive summaryHistory and evolution.docxThe analysis must includeExecutive summaryHistory and evolution.docx
The analysis must includeExecutive summaryHistory and evolution.docx
 
The annotated bibliography for your course is now due. The annotated.docx
The annotated bibliography for your course is now due. The annotated.docxThe annotated bibliography for your course is now due. The annotated.docx
The annotated bibliography for your course is now due. The annotated.docx
 
The Americans With Disabilities Act (ADA) was designed to protect wo.docx
The Americans With Disabilities Act (ADA) was designed to protect wo.docxThe Americans With Disabilities Act (ADA) was designed to protect wo.docx
The Americans With Disabilities Act (ADA) was designed to protect wo.docx
 
The air they have of person who never knew how it felt to stand in .docx
The air they have of person who never knew how it felt to stand in .docxThe air they have of person who never knew how it felt to stand in .docx
The air they have of person who never knew how it felt to stand in .docx
 
The agreement is for the tutor to write a Microsoft word doc of a .docx
The agreement is for the tutor to write a Microsoft word doc of a .docxThe agreement is for the tutor to write a Microsoft word doc of a .docx
The agreement is for the tutor to write a Microsoft word doc of a .docx
 
The abstract is a 150-250 word summary of your Research Paper, and i.docx
The abstract is a 150-250 word summary of your Research Paper, and i.docxThe abstract is a 150-250 word summary of your Research Paper, and i.docx
The abstract is a 150-250 word summary of your Research Paper, and i.docx
 

Recently uploaded

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.docxRamakrishna Reddy Bijjam
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
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.MaryamAhmad92
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 

Recently uploaded (20)

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
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
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.
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 

Take the following C code. (  see  file fib.c )1.)Compile .docx

  • 1. Take the following C code. ( see file fib.c ) 1.) Compile it and get results. 2.) Convert C code to MIPS. 3.) Using SPIM report on register step by stem using snip/or cut and copy screen shots. CODE: /* File: count_sort.c * Purpose: Implement count sort of a list of ints * * Compile: gcc -g -Wall -o count_sort count_sort.c * Run: ./count_sort * * Input: n (number of elements) * elements of list * Output: sorted list * * Note: List is statically allocated. Recompile if n > 100 */ #include #include #define MAX 100 void Read_list(int list[], int n); void Count_sort(int list[], int n);
  • 2. int Fnd_pos(int val, int i, int list[], int n); void Copy_list(int new_list[], int list[], int n); void Print_list(int list[], int n); int main(void) { int list[MAX], n; scanf("%d", &n); Read_list(list, n); // Print_list(list, n); Count_sort(list, n); Print_list(list, n); return 0; } /* main */ void Read_list(int list[], int n) { int i; for (i = 0; i < n; i++) scanf("%d", &list[i]); } /* Read_list */ /* Sort list of n elements by "counting" * number of elements less than each element, * and using the count as the subscript in * a new list */ void Count_sort(int list[], int n) { int i, loc, new_list[MAX]; for (i = 0; i < n; i++) { loc = Fnd_pos(list[i], i, list, n);
  • 3. new_list[loc] = list[i]; } Copy_list(new_list, list, n); } /* Count_sort */ /* Find the position to insert val among the elements * in list by counting the number of elements "less than" * val. In the case of a tie, an element list[j] is * considered "less than" val if j < i. */ int Fnd_pos(int val, int i, int list[], int n) { int j, count = 0; for (j = 0; j < n; j++) if (list[j] < val) count++; else if (list[j] == val && j < i) count++; return count; } /* Fnd_pos */ /* Copy contents of new_list into list. Both store * n elements */ void Copy_list(int new_list[], int list[], int n) { int i; for (i = 0; i < n; i++) list[i] = new_list[i]; } /* Copy_list */
  • 4. void Print_list(int list[], int n) { int i; for (i = 0; i < n; i++) printf("%d ", list[i]); printf("n"); } /* Print_list */