In this paper we establish a general determinantal representation of generalized inverses in terms of minors of an arbitrary matrix of an adequate order. Then we obtain a general algorithm for exact computation of different classes of pseudoinverses: Moore--Penrose inverse, group inverse, left, right inverses and Radižć's and Stojaković's inverse. In this way, this paper is a generalization of an earlier paper [12],where an algorithm for computing of the Moore--Penrose inverse, Radić's and Stojaković's inverse is described. We also give some examples which illustrate our results.