Hello. With the pseudo code you provided, it seems quite easy.
However, I would rather test the algorithm with your own real data. The accuracy of a machine algorithm strongly depends on the dataset used. So using cross validation is good, but with the R datasets such as Wine, Seed or Iris, it will not have a great meaning.
Thanks,
Nicolas