I'm having some major comprehension problems in figuring out this problem.
In the event that this is not appropriate for the list, my apologies
and feel free to flame me. I'm just so stuck right now. I have
checked the wikipedia algorithm page and even used the insertion sort
but it doesn't fit my case.
So I start by collecting a group of words which get put into the list[] array.
The task is to compare the words in list[] using < operator. The ones
that are true go into the "sorted array", the ones that fail go into
the "unsorted array".
The next step is to use the same operation but between the sorted and
unsorted arrays, till all is sorted in (yep) the sorted array. I've
been every which way and Sunday on this but so far have had little
luck and plenty of strange results.
My latest incarnation is this and it's only the first iteration (list
to either sorted or unsorted. I'm already aware that it makes no sense
but I don't have everything already tried nor would that make sense
either. I'm kind of stuck using each do for loops and pop push for
moving elements.
s_words.push(que_words[0]) #i do this to get at least one word into
the sorted array
que_words.each do |x|
s_words.each do |y|
if x < y
s_words.push(x)
end
end
end
que_words.each do |s|
s_words.each do |t|
if s == t
u_words.push(s)
end
end
end
Stuart