Test File

This is where programmers can upload the test file which they can use to test the speed of their code.
User avatar
basit
Site Admin
Posts: 194
Joined: May 17th, 2005, 8:10 pm
Contact:

Test File

Postby basit » July 11th, 2005, 10:41 am

Please note you wont be able to view/download the TEST.zip file if you have not registered on this forum . .


This is my simple code :-

'Size of each record is 3795
'Sort only column 31 (40 characters)

' CODE USING POWERBASIC
' OPEN THE RANDOM FILE

OPEN"test" FOR RANDOM ACCESS READ WRITE SHARED AS #1 LEN=3795
field#1,3795 as t$

NUM=LOF(1)/3795:' NUMBER OF RECORDS

dim huge t$(NUM)

for x=1 to NUM
get#1,x
t$(x)=mid$(t$,31,40)+"/"+str$(x): 'EXTRACT ONLY RECORDS THAT NEED TO BE SORTED
next x

PRINT"Busy sorting ..."
Flips = 1
WHILE Flips = 1
Flips = 0
FOR I = 1 TO Num - 1
IF T$(I) > T$(I + 1) THEN
SWAP T$(I), T$(I + 1)
Flips = 1
END IF
NEXT I
WEND

'WRITE THE RESULTS TO A FILE (SEQUENTIAL)
OPEN"O",#2,"TEST.SRT"
FOR I=1 TO NUM
PRINT#2,MID$(T$(I),42,10):'REM ONLY WRITE THE INDEX LOCATION
NEXT I
CLOSE#2

end
You do not have the required permissions to view the files attached to this post.
Last edited by basit on July 11th, 2005, 11:40 am, edited 1 time in total.

User avatar
basit
Site Admin
Posts: 194
Joined: May 17th, 2005, 8:10 pm
Contact:

The Best Sorter will be made public with source code.

Postby basit » July 11th, 2005, 11:43 am

My solution using PowerBasic on the test file runs out of memory . . if the file size is reduced to less than 10000 records it sorts the file taking 6 minutes on a P4 3.GHZ with 2gig memory. The problem with power basic is that huge arrays has to fit within the 640 dos limits. :(


BASit

User avatar
basit
Site Admin
Posts: 194
Joined: May 17th, 2005, 8:10 pm
Contact:

Postby basit » July 11th, 2005, 12:19 pm

Starts at 1

In PowerBasic> if a string is like this t$="test1234567890" column 1 will have "t" in it and column five will have "1" , so for example you want to use four digits(7890) from the test string above you will use the mid$ command and start at column 11 an choose 4 digits >>> mid$(t$,11,4)

Hope this helps

BASit

Dejan Mitrovic
Posts: 5
Joined: July 11th, 2005, 12:42 pm

Postby Dejan Mitrovic » July 11th, 2005, 4:27 pm

Hi,

My results are (for quicksort):
reading input - 44.24 sec
sorting - 0.219 sec
writing output - 0.47 sec
total ---------------------------- 44.929 sec

My other algorithm takes 44.19 sec to complete everything.

Configuration is Athlon 1.2GHz, 512 MB, XP with SP2

Dejan


Return to “File Sorter”

Who is online

Users browsing this forum: No registered users and 1 guest