Question: Implement the following 3 functions and put your code for 3 functions in a single file called homework 2 . cpp . Function 1 :

Implement the following 3 functions and put your code for 3 functions in a single file called homework2.cpp. Function 1: int out_of_order(int a[,int n);
This function returns the number of out order pairs in an array a of size n. Example 1 : input: a=[3,1,2],n=3 return: 2(there are 2 pairs that are out of order: (3,1) and (3,2)) Example 2: input: a=[1,2,3,4,5],n=5 return: 0(all pairs are in order) Example 3 : input: a=[1,5,3,2],n=4 return: 3(there are 3 pairs that are out of order: (5,3),(5,2),(3,2))
Function 2: string binary_to_hex(const string& s);
this function converts a binary string s into a hexadecimal string Example 1: input: s="11010" return: "1a" Example 2: input: s="111000011111" return: "e1f"
Function 3: void shift_, int n); ?*********** This function shifts all 0 to the end of array a while keeping non-0 numbers in the same order. Change the array a in place. Don't create a new array. Example 1: input: a=[1,0,2,0,3],n=5 output: a=[1,2,3,0,0] Example 2: input: a=[0,2,0,0,1,3],n=6 output: a=[2,1,3,0,0,0] NO MAIN CASE PLEASE
 Implement the following 3 functions and put your code for 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!