Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Loopin a variable length array
Message
De
24/02/1999 10:59:57
 
 
À
24/02/1999 04:54:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00189697
Message ID:
00190958
Vues:
14
>Hello James
>An alternate solution to implementing this as an array is to implement it as a linked list
>Your mediator (or raher your publisher) would hold 3 refrences
>the begining of the list, the end of the list and the for the current "node" and each object will have a propety holding reference to the next in line
>
>Adding a new object is o(1) (you can verify that an object is not already in the chain by checking its refrence property - or another)
>removing an object from the chain is o(n) to find it and o(1) to actually remove it
>and scanning through the whole chain is also o(n)
>
>HTH
>
>Arnon

The penalty of initializing a new object is huge compared to adding a new array element. If you just from the end of the array as though it is a stack, the task is fast and easy to manage.

VFP needs a lighter weight base class for creating custom data structures like tree/trie nodes and linked list nodes. This would be especially handy if these classes could map to C structures.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform