asking for CS coauthor as an undergraduate
Yes. Implementing part of the algorithm, running it and producing the figures, and especially writing a significant portion of the text of the paper, are all contributions that should count for a listing in the authors.

We can't exactly know whether your contribution to each of these were "significant" without seeing the paper, but it is very likely. So, ask.