+Vorticon Posted April 16 Share Posted April 16 Hi. I'm tinkering with a project that I'm not sure I will fully pursue yet, but nonetheless it requires sorting an integer array in ascending order (it can sort a 2 dimensional array for either column 1 or 2). I implemented a sort function as shown below, but performance for even 30 elements is dismal. Any suggestions for something better? 5000 REM ARRAY SORTING ROUTINE 5020 EFLAG=0 5030 FOR I=1 TO R 5035 IF I=R THEN 7160 5040 IF COL=2 THEN 7110 5060 V1=DLIST(I,1)::V2=DLIST(I+1,1) 5070 IF V2<V1 THEN DLIST(I,1)=V2::DLIST(I+1,1)=V1::EFLAG=1 7080 GOTO 7160 7110 V1=DLIST(I,2)::V2=DLIST(I+1,2) 7120 IF V2<V1 THEN DLIST(I,2)=V2::DLIST(I+1,2)=V1::EFLAG=1 7160 NEXT I 7170 IF EFLAG=1 THEN 5020 7180 RETURN Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.