Question: 1 . ( 1 0 pts ) Write a function called my _ str _ n _ cat ( ) that accepts pointer to a
pts Write a function called mystrncat that accepts pointer to a destination character array, a pointer to a source character array which is assumed to be a string and an integer n and returns the pointer to the destination character array. This function needs to copy at most n characters, character by character, from the source character array to the end of the destination character array. If a null character is encountered before n characters have been encountered, copying must stop. You may NOT use any
functions found in to solve this problem! Note: you MUST use pointer arithmetic in this function only.
pts Recall Binary Search:
Input: a list of n sorted integer values and a target value
Output: True if target value exists in list and location of target value, false otherwise
Method:
Set left to and right to n
Set found to false
Set targetindex to
While found is false and left is less than or equal to right
Set mid to midpoint between left and right
If target item at mid then set found to true and set targetindex to mid
If target item then set right to mid
If target item then set to left to mid Return the targetindex
Write a C function called binarysearch
pts Write a function called bubblesort that accepts an array of pointers to strings and the number of strings as arguments, and returns nothing. The function sorts the strings according to the following algorithm:
set the marker U for the unsorted section at the end of the list U is an integer index value
while the unsorted section has more than one element do steps through set the current element marker C at the second element of the list C is an integer index value
while C has not passed U do steps and
if the item at position C is less than the item to its left then exchange these two items
move C to the right one position
move U left one position stop
Your implementation for this function may NOT use strcpy You may only exchange or swap pointers, but NOT actually make copies of the strings!
pts Write a recursive function called ispalindrome that accepts a pointer to a string and its length, and recursively determines if the string is a palindrome. The function must return for a palindrome, otherwise. A palindrome is a sequence of symbols that may be interpreted the same forwardand backward. For example, race car Note: whitespace should be ignored in your solution.
Andrew S OFallon
pts Write a recursive function called sumprimes that accepts an unsigned integer, n as an argument, and returns the sum of all primes from to n You must use recursion to solve this problem!
pts Write a function called maximumoccurences that accepts a pointer to a string consisting of alphanumeric and whitespace characters only a pointer to an array of struct occurrences, a pointer to an integer, and a pointer to a character as arguments. The structure is defined as follows:
typedef struct occurrences
int numoccurrences;
double frequency; Occurrences;
The function determines the frequency of each character found in the array. The frequency is defined as: number of one character symbol total number of characters. The function should use the second array argument of struct occurrences to keep track of the frequency of each character. Also, it must return, through the pointers, the maximum number of occurrences of any one character and the corresponding character for which the maximum represents. Thus, for a string such as test stringt occurs times, which is the maximum occurrences for any one character in the string.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
