CLASS 3D

Latest news from this site.

Moderators: Pete, Mods

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

CLASS 3D

Post 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
angros47
Veteran
Posts: 79
Joined: Mon Sep 08, 2008 12:52 pm
Contact:

Post 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.
lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

I agree with your opinion, is correct, Ok!

Post 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
angros47
Veteran
Posts: 79
Joined: Mon Sep 08, 2008 12:52 pm
Contact:

Post 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.
lrcvs
Veteran
Posts: 58
Joined: Mon Mar 10, 2008 9:28 am

Post by lrcvs »

Excellent website and good example.

Thanks, angos47 !!!
Post Reply