Solved-Assignment 111- Solution

$30.00 $19.00

Write a recursive C function to find the median of n positive integers. [Hint: A main function reads number of elements (n) and also reads and store the n elements (integer) in a global array. A recursive function find_median is called from the main function which returns media. Recursive function randomly select an element from…

You’ll get a: . zip file solution

 

 

Description

5/5 – (2 votes)
  1. Write a recursive C function to find the median of n positive integers. [Hint: A main function reads number of elements (n) and also reads and store the n elements (integer) in a global array. A recursive function find_median is called from the main function which returns media. Recursive function randomly select an element from array and divide the array into two parts where one array contains all the elements lower than the randomly selected element and other array holds all elements greater than the randomly selected element. And call the recursion on appropriate sub-array. Find the n/2 th element when n is even and (n+1)/2 th element when n is odd.]

Upload assign3A.c

  1. An even word is a word that contains an even number of copies of every letter. For example, the word “tattletale” is an even word, since there are four copies of ‘t’ and two copies of ‘a,’ ‘e,’ and ‘l.’ Similarly, “appeases” and “arraigning” are even words. However, “banana” is not an even word, because there is just one ‘b’ and three copies of ‘a.’ Write a function

bool isEvenWord(string word)

that accepts as input a string representing a single word and returns whether or not that word is an even word. Your solution should be recursive and must not use any loops (e.g. while, for).

As a hint, this problem has a beautiful recursive decomposition:

  • The empty string is an even word, since it has 0 copies of every letter.

  • Otherwise, a word is an even word if there are at least two copies of the first letter and the word formed by removing two copies of the first letter is itself an even word.

Upload assign3B.c

  1. An array contains positive as well as negative numbers. Please find out the maximum sub-array sum using recursion.

Upload assign3C.c