What is the Shortest,Efficient,Fast, Code Possible QB64 Sort ?

05162017, 06:53 AM
Post: #11
(Print Post)




RE: What is the Shortest,Efficient,Fast, Code Possible QB64 Sort ?
I Found this and it looked Interesting...
Converted to (Uppercase!) Because My Eyes like it! and one of the Reasons I hate the look of C / C++ Code although I suppose I could also Convert that to (Uppercase!) ? COCKTAIL SORT... THE BUBBLE SORT WORKS GREAT BUT I WAS LOOKING INTO THE COCKTAIL SORTING ALGORITHM WHICH IS BASICALLY THE BUBBLE SORT BUT IT ALSO BUBBLE SORTS THE OPPOSITE DIRECTION. DIM A(9) A(0)=5 A(1)=4 A(2)=7 A(3)=2 A(4)=8 A(5)=1 A(6)=9 A(7)=10 A(8)=3 'ARRAY LENGTH SUBTRACT 1 ALENGTH=81 'BUBBLE DOWN THE ARRAY FOR X=0 TO ALENGTH FOR I=X TO (ALENGTHX) IF A(I) > A(I+1) THEN TEMP=A(I) A(I)=A(I+1) A(I+1)=TEMP END IF NEXT I 'BUBBLE UP THE ARRAY FOR T=(ALENGTH X) TO (X+1) STEP 1 IF A(T) < A(T1) THEN TEMP=A(T1) A(T1)=A(T) A(T)=TEMP END IF NEXT T NEXT X 

05162017, 07:07 AM
Post: #12
(Print Post)




RE: What is the Shortest,Efficient,Fast, Code Possible QB64 Sort ?
Yes, this one could be improved by swap too.
Quick sort would be faster than this too. Where did you find this? an older BASIC? B += _ 

05162017, 07:28 AM
(This post was last modified: 05162017 07:30 AM by Anthony.R.Brown.)
Post: #13
(Print Post)




RE: What is the Shortest,Efficient,Fast, Code Possible QB64 Sort ?
I Could not find the Original link
Found it!... http://justbasic.conforums.com/index.cgi...1120928790 But! when I tried to Run the first Version...there is a mistake ? Anthony. 

The following 1 user Likes Anthony.R.Brown's post: bplus 
05162017, 08:58 AM
Post: #14
(Print Post)




RE: What is the Shortest,Efficient,Fast, Code Possible QB64 Sort ?
Yep! JB does not have swap. Nice to learn the alternate way too.
B += _ 

05162017, 01:46 PM
(This post was last modified: 05162017 01:47 PM by Anthony.R.Brown.)
Post: #15
(Print Post)




RE: What is the Shortest,Efficient,Fast, Code Possible QB64 Sort ?
This may help... (If Only I understood what they are talking about)


The following 1 user Likes Anthony.R.Brown's post: bplus 
05162017, 01:52 PM
Post: #16
(Print Post)




RE: What is the Shortest,Efficient,Fast, Code Possible QB64 Sort ?
I think all you need to understand is to see which is on top!
Should be easy... B += _ 

05162017, 02:22 PM
Post: #17
(Print Post)




RE: What is the Shortest,Efficient,Fast, Code Possible QB64 Sort ?
Yes! some Guys like to be on top!


The following 1 user Likes Anthony.R.Brown's post: bplus 
05162017, 02:30 PM
Post: #18
(Print Post)




RE: What is the Shortest,Efficient,Fast, Code Possible QB64 Sort ?
Some Sorts too apparently
B += _ 

09052017, 04:26 PM
Post: #19
(Print Post)




RE: What is the Shortest,Efficient,Fast, Code Possible QB64 Sort ?
I knew I discussed Quick Sort with someone!
B += _ 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)
Powered By MyBB, © 20022017 MyBB Group.
Most website layout graphics on this site is © 2014  Walter Whitman. All Rights Reserved.
Most website layout graphics on this site is © 2014  Walter Whitman. All Rights Reserved.