Computer Science homework help

Take the following C code. (  see  file fib.c )
 
1.)  Compile it and get results.
2.)  Convert C code to MIPS.
3.) …

  • 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 <stdio.h>

    #include <stdlib.h>

    #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 */

Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!