php and java implementations of data structures