Hello,

	If I want to know that an element is exist in a datastructure, I can use hash to achieve with O(1):

$x{a}=1;
$x{b}=1;

do something .. if exists $x{a};

	However, regarding of large memory size that a hash requires, I'm hastitate to use "perl hash" to tell whether some elements exist or not. (I don't want to know their corresponding values, I'm just want to know if it exists)

	The fisrt datastructure that come into my head is binary search tree. Even though its searching speed is not  as fast as of hash (O(log N)), the data structure requires less memory..

	Yesterday, my friend told me that python and php have a built-in function to search their array. For python he said that python implements array with something like heap and it benefits for searching in array !?

	I wonder if "perl list" provides function for searching elements !? I think it is not good to do a bruteforce search in an unsorted array. If Perl list is built basing on data structures that enhance searching, it is possible to provide built-in fuction for searching !?


Regards,


_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to