Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Just answer one number. Use c++ and explain code please. Thanks Question 3: Implement the function: void odds KeepEvensFlip (int arr[], int arrSize) This function

image text in transcribed

Just answer one number. Use c++ and explain code please. Thanks

Question 3: Implement the function: void odds KeepEvensFlip (int arr[], int arrSize) This function gets an array of integers arr and its logical size arrSize. When called, it should reorder the elements of arr so that: 1. All the odd numbers come before all the even numbers 2. The odd numbers will keep their original relative order 3. The even numbers will be placed in a reversed order (relative to their original order). For example, if arr = [5, 2, 11, 7, 6, 4], after calling odds KeepEvens Flip(arr, 6), arr will be: [5, 11, 7, 4, 6, 2] Implementation requirements: 1. Your function should run in linear time. That is, if there are n items in arr, calling oddsKeepEvensFlip(arr, n) will run in O(n). 2. Write a main() program that tests this function. 3. Note that at the end, the elements should be stored starting at the same base address, as was given in arr. Question 4: Implement the function: stringcreateWordsArray (string sentence, int& outWordsArrSize) This function gets a string sentence containing a sentence. When called, it should create and return a new array (of strings), that contains all the words in sentence. The function should also update the output parameter, outWordsArrSize, with the logical size of the new array that was created. Note: Assume that the words in the sentence are separated by a single space. For example, if sentence="You can do it", after calling createWordsArray (sentence, outWordsArrSize), the function should create and return an array that contains ["You","can" , "do" , "it"], and update the value in outWordsArrSize to be 4. Implementation requirements: 1. You may want to use some of the string methods, such as find, substr, etc. 2. Your function should run in linear time. That is, if sentence contains n characters, your function should run in O(n). 3. Write a main () program that tests this function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases 11th British National Conference On Databases Bncod 11 Keele Uk July 7 9 1993 Proceedings Lncs 696

Authors: Michael F. Worboys ,Anna F. Grundy

1993rd Edition

3540569219, 978-3540569213

More Books

Students also viewed these Databases questions

Question

What happens to the pH of soda water as it loses its carbonation?

Answered: 1 week ago

Question

What are Electrophoresis?

Answered: 1 week ago