[algorithm.lexicographical_compare, algorithm.tristate_lexicographical_compare]

Fix tristate_lexicographical_compare InputIterator version (wrong version was called).
Reduce compare function application for RandomAccessIterator verion.
Move some common functions to new header file.