字符串中最长的回文

编程入门 行业动态 更新时间:2024-10-19 06:25:53
本文介绍了字符串中最长的回文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

嗨 你能告诉我在字符串中找到最长的回文子字符串的最佳方法。 请解释。我有很多链接但是无法理解

Hi can you tell me the best way to find longest palindrome sub string in a string. please explain .i got lot of link but not able to understand

推荐答案

这个问题有一个很好的讨论,这里有一个非常优化的算法: www.akalin.cx/longest-palindrome-linear-time [ ^ ] 它的工作原理是寻找来自的回文中心,这是一个如此明智的想法,它让你去:doh:!为什么我没想到这个?。 我留下它作为读者在C中实现它的练习 - 但它根本不需要任何树木! There is a good talk through of this problem, complete with a pretty much optimal algorithm here: www.akalin.cx/longest-palindrome-linear-time[^] It works by looking for palindromes from the centers, which is such a bright idea that it makes you go ":doh:! Why didn''t I think of that?". I leave it as an exercise for the reader to implement it in C - but it doesn''t need any trees at all!

更多推荐

字符串中最长的回文

本文发布于:2023-11-30 09:34:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1649515.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:回文   字符串   最长

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!