Question: Using this code: function sortedWords(array) sortedarray={}; while ~isempty(arrayy) [m,pos]=findSmallest(array); array(pos)=[]; sortedarray=[sortedarray m]; end function [m,pos]=findSmallest(array) m= ? pos=1; for i=2:length(array) if is LessWord(?.m) m= ?
Using this code:
function sortedWords(array)
sortedarray={};
while ~isempty(arrayy)
[m,pos]=findSmallest(array);
array(pos)=[];
sortedarray=[sortedarray m];
end
function [m,pos]=findSmallest(array)
m= ?
pos=1;
for i=2:length(array)
if is LessWord(?.m)
m= ?
pos=i;
end
end
function less=isLessWord(wordA,wordB)
worda=lower(wordA);
wordb=lower(wordB);
Write a function sortWords (array) that does the following: 1. Takes as an input a cell array of strings consisting of letters only. (1 pts) 2. Returns a cell array with all the strings in alphabetical order. (5 pts) 3. The function should ignore whether letters are lower case or upper case. (2 pts) Test your function with the following: (e pts) >> sorted-sortWords ({"Hello, , , hell, , , abc, , , aa, , , a za , , , aab, , , AaBb , , , a, }) sorted- 'a' 'aa''aab' 'AaBb' 'abc' 'aza''hell' 'Hello Note: Your function may not contain any built-in MATLAB function(s) that deal with sorting or finding minimum values. If your function-does use these built-in functions, up to 8 points may be deducted from your total. Hint: Use the program sharkSort (vec) as a starting point and amend it so that it works for this programming assignment. For example your function could start as follows (fill in the blanks as necessary)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
