The discretization of probability density functions (pdf's) is often necessary in financial modelling, especially in derivatives pricing and hedging, where certain pdf characteristics (e.g. fat tails) can have a disproportionate effect on prices. We present an exact dynamic programming (DP) algorithm to perform such a discretization optimally. We investigate the parallelisation of the DP algorithm and show that an almost linear speed-up is possible. For a large number of dimensions an approximate algorithm for the discretization of multivariate pdf's is presented. Computational results are reported for all variants of the algorithm when applied to different pdf's with various required levels of discretization.