PDA

View Full Version : computational complexity of array functions in php


mariya
04-21-2007, 03:19 PM
Hi all,

I am having trouble finding the computational complexity of array_multisort, is_array_key and array_intersect in PHP. Does anyone know?

Many thanks,
Mariya

bauhsoj
04-21-2007, 07:12 PM
Do you mean you want to know how much CPU power and time the execution of those requires?

marek_mar
04-21-2007, 07:23 PM
You won't write better versions of them in PHP.

mariya
04-21-2007, 08:22 PM
hi,

No, just writing a paper on it and need to know the big oh complexity of them...don't worry, I'm not going to try and write something better :)

Mariya

marek_mar
04-21-2007, 09:25 PM
I can only say for sure that is_array_key does not exist. :p
array_multisort() should still be around O(n * lg(n)) for each array argument as there should be a decent sorting algorithm used.
array_intersect() would be harder to tell. You'd have to calculate it.