In this paper, we consider the concept of b-generalized pseudodistances with the concept of weak contraction for non-self mapping by provide the condition guarantee the existence of best proximity point and an algorithm for determining such an optimal approximate solution to the problem of globally minimizing the error $$\inf \{ d(x,y): x \in A,y\in B\}$$ where A and B are nonempty close subsets of b-metric spaces X. Also, we give some example to illustrate our main result.