ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 29 May 2017 My Price 9.00

Program Design*/#include #define

Can you please help?  I'm a first timer and had other projects but this seems to be difficult

 

Project 6, Program Design1.This program will be graded based on whether the required functionality wereimplemented correctly instead of whether it produces the correct output, for thefunctionality part (80% of the grade).Modify selection_sort.c so that it includes the following functions:void selection_sort(int *a, int n);int *find_largest(int *a, int n);void swap(int *p, int *q);selection_sort function: it should call find_largest function and swap function.find_largest function: when passed an array of length n, the function will return apointer to the array’s largest element.The function should use pointer arithmetic – notsubscripting – to visit array elements. In other words, eliminate the loop index variablesand all use of the [] operator in the function.swap function: when passed the addresses of two variables, the function shouldexchange the values of the variables:swap(&i, &j);/* exchange values of i and j */Your program will call find_largest function and swap function in selection_sortfunction.2.A vector is an ordered collection of values in mathematics. An array is a verystraightforward way to implement a vector on a computer. Two vectors are multipliedon an entry-by-entry basis, e.g. (1, 2, 3) * (4, 5, 6) = (4, 10, 18).Write a program that include the following functions.The functions should use pointerarithmetic (instead of array subscripting). In other words, eliminate the loop indexvariables and all use of the [] operator in the functions.void multi_vec (int *v1, int *v2, int *v3, int n);

/*selection_sort.c, project 6, Program Design*/#include <stdio.h>#define N 10void selection_sort(int a[], int n);int main(void){int i;int a[N];printf("Enter %d numbers to be sorted: ", N);for (i = 0; i < N; i++)scanf("%d", &a[i]);selection_sort(a, N);printf("In sorted order:");for (i = 0; i < N; i++)printf(" %d", a[i]);printf("\n");return 0;}void selection_sort(int a[], int n){int i, largest = 0, temp;if (n == 1)return;for (i = 1; i < n; i++)if (a[i] > a[largest])largest = i;if (largest < n - 1) {temp = a[n-1];a[n-1] = a[largest];a[largest] = temp;}selection_sort(a, n - 1);}

Attachments:

Answers

(11)
Status NEW Posted 29 May 2017 07:05 AM My Price 9.00

-----------

Attachments

file 1496043117-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)