Improvements to Hash::expand and Hash::merge.

Because of the recursion in these functions, processing very large
arrays would take a very long time. I rewrote the functions to
eliminate any unnecessary recursion and function calls. Large arrays
are now processed much faster.
Fixed coding standard violations.
Merge pull request #4788 from hperrin/3.0_hash_improvements

Improvements to Hash::expand and Hash::merge. (3.0)