Question: Using MATLAB programming Now it's your turn, again. Write a function (reverse_sentence.m) that takes a single input argument which is a string containing a sentence
Now it's your turn, again. Write a function (reverse_sentence.m) that takes a single input argument which is a string containing a sentence (a sequence of words) and returns a single output argument which is a string containing the words in the input string in reverse order. For example, on input 'the quick brown fox jumps over the lazy dog', the function should return 'dog lazy the over jumps fox brown quick the'. Remember to think before you code. Have pencil and paper next to you and sketch your algorithm as pseudocode or flow diagram. I will get you started on this one: 1. Split the sentence at whitespace to form an array of words. 2. Reverse the array of words. 3. Construct the reversed sentence by joining the words in the array with spaces
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
