Question
My code is below, but I cannot use the last line of code(less=string(worda) function sortedarray=sortWords(array) sortedarray={}; while ~isempty(array) [m,pos]=findSmallest(array); array(pos)=[]; sortedarray=[sortedarray m]; end end function
My code is below, but I cannot use the last line of code(less=string(worda) function sortedarray=sortWords(array) sortedarray={}; while ~isempty(array) [m,pos]=findSmallest(array); array(pos)=[]; sortedarray=[sortedarray m]; end end function [m, pos]=findSmallest(array) m = array{1}; pos=1; for i=2:length(array) if isLessWord(array{i}, m) m=array{i}; pos=i; end end end function less=isLessWord(wordA,wordB) worda=lower(wordA); wordb=lower(wordB); less=string(worda) end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started