## Abstract

Hairpin completion is an operation on formal languages that has been inspired by hairpin formation in DNA biochemistry and has many applications especially in DNA computing. Consider s to be a string over the alphabet {A, C, G, T} such that a prefix/suffix of it matches the reversed complement of a substring of s. Then, in a hairpin completion operation the reversed complement of this prefix/suffix is added to the start/end of s forming a new string. In this paper we study two problems related to the hairpin completion. The first problem asks the minimum number of hairpin operations necessary to transform one string into another, number that is called the hairpin completion distance. For this problem we show an algorithm of running time O(n^{2}), where n is the maximum length of the two strings. Our algorithm improves on the algorithm of Manea (TCS 2010), that has running time O(n^{2} log n). In the minimum distance common hairpin completion ancestor problem we want to find, for two input strings x and y, a string w that minimizes the sum of the hairpin completion distances to x and y. Similarly, we present an algorithm with running time O(n^{2}) that improves by a O(log n) factor the algorithm of Manea (TCS 2010).

Original language | English |
---|---|

Title of host publication | 34th Annual Symposium on Combinatorial Pattern Matching, CPM 2023 |

Editors | Laurent Bulteau, Zsuzsanna Liptak |

Publisher | Schloss Dagstuhl- Leibniz-Zentrum fur Informatik GmbH, Dagstuhl Publishing |

ISBN (Electronic) | 9783959772761 |

DOIs | |

State | Published - Jun 2023 |

Event | 34th Annual Symposium on Combinatorial Pattern Matching, CPM 2023 - Marne-la-Vallee, France Duration: 26 Jun 2023 → 28 Jun 2023 |

### Publication series

Name | Leibniz International Proceedings in Informatics, LIPIcs |
---|---|

Volume | 259 |

ISSN (Print) | 1868-8969 |

### Conference

Conference | 34th Annual Symposium on Combinatorial Pattern Matching, CPM 2023 |
---|---|

Country/Territory | France |

City | Marne-la-Vallee |

Period | 26/06/23 → 28/06/23 |

### Bibliographical note

Publisher Copyright:© 2023 Schloss Dagstuhl- Leibniz-Zentrum fur Informatik GmbH, Dagstuhl Publishing. All rights reserved.

## Keywords

- dynamic programming
- exact algorithm
- incremental trees