Generalized Newton-Type Methods For Nonsmooth Equations In Optimization And Complementarity Problems