In this paper, we give an explicit computable algorithm for the Zelevinsky-Aubert duals of irreducible representations of p-adic symplectic and odd special orthogonal groups. To do this, we establish explicit formulas for certain derivatives and socles. We also give a combinatorial criterion for the irreducibility of certain parabolically induced representations.