Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to migrate VFP prog to C/S ?
Message
 
À
24/03/1998 17:22:09
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00085402
Message ID:
00086965
Vues:
45
>>>>With a binary search, there will be approximatively 27 search = 27 network access of 10 bytes = 270 bytes !!
>>>
>>>Fox will be even more efficient. Fox uses b-trees, not binary trees. B-trees have multiple values per node and are self-balancing. Simple binary trees have one value per node and are not self-balancing (the worst case is when you add presorted data - you end up with a singly linked list).
>>
>>What Emmanuel is talking about is the search method computational complexity (using the index). The value (27 accesses) represent the worst case scenario. BTW, binary trees, by definition, have two leaves per node, hence the name, and are not the same as linked lists, which have only one.
>
>reread what I said.
>
>binary tree worst case:
>
>node1.right->node2.right->node3.right->node4.right->node5.right
>
>If you don't have any nodes on the left branch you have created a linked list. The reference was made because of the self-balancing nature of b-trees. Simple binary trees are not self-balancing (red-black trees, etc. are self-balancing).
>
>I believe he was addressing index efficiency as measured by the number of comparisons required to find a matching record (or fail) - not computational complexity.

Well keeping binary tree "in balance" is a problem that any computer science student should have encountered and solved by the end of their second year in school. From the point of view that they contain the same elements binary trees and b-trees are exactly the same (both would have data, and a left and right pointer to the next "leaves").

I'm not sure, however, that "binary search" is precisely the right term for this. In order to a binary search the list must be ordered, you must know the number of elements and, of course, be able to randomly access the data elements. A sorted array or list object can be searched using a binary search with exactly the same efficiency. Since, however, the principal of partitioning the data is the same, searching a balanced binary tree would be the same.

Speaking of which, you're right, I should have said cardinality rather than computational complexity.
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform