Localization is one of the most fundamental problems in ocean sensor networks. Current localization algorithms mainly focus on how to localize as many sensors as possible given a set of mobile or static anchor nodes and distance measurements. In this paper, we consider the optimization problem, minimum cost localization problem in a 3D ocean sensor network, which aims to localize all underwater sensors using the minimum number of anchor nodes or the minimum travel distance of the ship which deploys and measures the anchors. Given the hardness of 3D localization, we propose a set of greedy methods to pick the anchor set and its visiting sequence. Aiming to minimize the localization errors, we also adopt a confidence-based approach for all proposed methods to deal with noisy ranging measurements and possible flip ambiguity. Our simulation results demonstrate the efficiency of all proposed methods.