CLASS 3D

Latest news from this site.

Moderators: Pete, Mods

lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

CLASS 3D

Postby lrcvs » Mon Aug 24, 2009 4:28 am

Program of ordination or classification 3D

Name: "CLASS 3D"

lrcvs 24.08.09

(Is limited, but...power)


CLS

DIM a$(9, 9, 9)

FOR n = 1 TO 1000
RANDOMIZE TIMER
x$ = LTRIM$(STR$(INT(RND * 999)))
IF LEN(x$) < 3 THEN l$ = STRING$(3 - (LEN(x$)), "0"): x$ = l$ + x$
a$(VAL(LEFT$(x$, 1)), VAL(MID$(x$, 2, 1)), VAL(RIGHT$(x$, 1))) = x$
NEXT n

FOR x = 0 TO 9
FOR y = 0 TO 9
FOR z = 0 TO 9

IF a$(x, y, z) <> "" THEN PRINT a$(x, y, z); " ";

NEXT z, y, x

angros47
Veteran
Posts: 70
Joined: Mon Sep 08, 2008 12:52 pm
Contact:

Postby angros47 » Mon Aug 24, 2009 6:19 am

Your program does not sort data, it only stores data in cells with the same number. It also wastes memory, leaving a lot of unused cells.

If you have to sort words of five letters, you'd need 26*26*26*26*26=11881376 cells! And you would never fill them all.

To sort data, you could use a bubble sort algorithm, it's more efficient.

lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

I agree with your opinion, is correct, Ok!

Postby lrcvs » Mon Aug 24, 2009 7:54 am

Ok.

True!

I agree with your opinion, is correct, Ok!

1) The program is only for numbers.

2) I am limited by the program memory.

3)... but ... the best is the new way to do it for me unknown!

4) Not classified directly positions the numbers in his cell and removes the repeated, in the end we get a list of numbers, orderly.

I think it is a good method.

Thanks for your opinion!

Greetings

angros47
Veteran
Posts: 70
Joined: Mon Sep 08, 2008 12:52 pm
Contact:

Postby angros47 » Tue Aug 25, 2009 1:55 am

Have a look at this: http://www.tek-tips.com/faqs.cfm?fid=336

You can sort an array, or only part of it.

lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

Postby lrcvs » Tue Aug 25, 2009 11:18 am

Excellent website and good example.

Thanks, angos47 !!!


Return to “Pete's QB Site News”

Who is online

Users browsing this forum: No registered users and 3 guests