Page 1 of 1

CLASS 3D

Posted: Mon Aug 24, 2009 4:28 am
by lrcvs
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

Posted: Mon Aug 24, 2009 6:19 am
by angros47
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.

I agree with your opinion, is correct, Ok!

Posted: Mon Aug 24, 2009 7:54 am
by lrcvs
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

Posted: Tue Aug 25, 2009 1:55 am
by angros47
Have a look at this: http://www.tek-tips.com/faqs.cfm?fid=336

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

Posted: Tue Aug 25, 2009 11:18 am
by lrcvs
Excellent website and good example.

Thanks, angos47 !!!