Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question on a Quick Sort routine
#1
Under what condition(s) [if any], can a call to a sort routine NOT require a list of arguments? Is there a difference between multiple sorts within the same module v's multiple Calls to the same Sub doing the sorting? I'm thinking more the case of sorting different Arrays with the same number of elements as opposed to multiple sorts of the same Array.
Reply
#2
Geez Louiezzz .. forget I asked this question. Muddled thinking on my part. Spending too much time on this damn computer, need to find a party somewhere.
Reply
#3
Quote:Under what condition(s) [if any], can a call to a sort routine NOT require a list of arguments?

A Shared array won't have to be passed in the call as long as the sub is setup for it, same with any other parameter ie a totally dedicated one-off routine for your very special array that is app specific and you don't give a hoot if you can use the routine again anywhere anywhen in the future.

All these crazy what if questions that come from Dimster leaving us in the dark what is motivating them. ;-))
b = b + ...
Reply
#4
Thanks b+ - motivation is simply error messages and failed code or misunderstanding of the proper syntax. In this Sort case, its an error message that I did get years ago and forgot exactly how I solved it. In my program I have multiple sorts and this one particular sort kept erroring out with the message that it did not require the arguments when I knew if did. I was having a hard time trying to understand why all the others worked perfectly and yet this one was a no go. Immediately after posting for some ideas as what I was missing the problem and solution became obvious. In fact, it was so obvious that I didn't think it was the problem - unable to see the forest for the trees again.

Anyway, I use the Start, Finish variables to control the number of sorts and then the sort call becomes SortArray (begin, finish, Array2Sort()). The error happened because I inadvertently called the SortArray(Start, Finish, Array2Sort()).

I don't even recall typing it that way and to make matters worst, I spent about 1 hour looking at this and could see what the problem was.
Reply
#5
(09-24-2023, 02:27 PM)Dimster Wrote: Thanks b+ - motivation is simply error messages and failed code or misunderstanding of the proper syntax. In this Sort case, its an error message that I did get years ago and forgot exactly how I solved it. In my program I have multiple sorts and this one particular sort kept erroring out with the message that it did not require the arguments when I knew if did. I was having a hard time trying to understand why all the others worked perfectly and yet this one was a no go. Immediately after posting for some ideas as what I was missing the problem and solution became obvious. In fact, it was so obvious that I didn't think it was the problem - unable to see the forest for the trees again.

Anyway, I use the Start, Finish variables to control the number of sorts and then the sort call becomes SortArray (begin, finish, Array2Sort()). The error happened because I inadvertently called the SortArray(Start, Finish, Array2Sort()).

I don't even recall typing it that way and to make matters worst, I spent about 1 hour looking at this and could see what the problem was.

Yeah either CALL it or remove extra ( )'s I have same problem going from QB64 to JB. In JB you don't use () even when you define the SUB. The error message for that in JB is useless!
b = b + ...
Reply




Users browsing this thread: 4 Guest(s)