  We obtain the functions that bound the dimensions of finite dimensional
nilpotent associative or Lie algebras of class 2 over an algebraically closed
field in terms of the dimensions of their commutative subalgebras. As a result,
we also compute a similar function for complex nilpotent Lie groups of class 2.
