leetcode 234. Palindrome Linked List
来源:互联网 发布:linux系统基础教程 编辑:程序博客网 时间:2024/05/14 15:03
Reversing a list is not considered “O(1) space”
It is a common misunderstanding that the space complexity of a program is just how much the size of additional memory space being used besides input. An important prerequisite is neglected the above definition: the input has to be read-only. By definition, changing the input and change it back is not allowed (or the input size should be counted when doing so). Another way of determining the space complexity of a program is to simply look at how much space it has written to. Reversing a singly linked list requires writing to O(n) memory space, thus the space complexities for all “reverse-the-list”-based approaches are O(n), not O(1).Solving this problem in O(1) space is theoretically impossible due to two simple facts: (1) a program using O(1) space is computationally equivalent to a finite automata, or a regular expression checker; (2) the pumping lemma states that the set of palindrome strings does not form a regular set.
Please change the incorrect problem statement.
- [leetcode] 234.Palindrome Linked List
- [LeetCode]234.Palindrome Linked List
- [leetcode] 234.Palindrome Linked List
- 【leetcode】234. Palindrome Linked List
- 【LeetCode】234. Palindrome Linked List
- [leetcode] 234. Palindrome Linked List
- 234. Palindrome Linked List LeetCode
- LeetCode--234. Palindrome Linked List
- LeetCode 234. Palindrome Linked List
- 【LeetCode】234. Palindrome Linked List
- leetcode 234. Palindrome Linked List
- LeetCode *** 234. Palindrome Linked List
- LeetCode 234. Palindrome Linked List
- leetcode-234. Palindrome Linked List
- LeetCode-234.Palindrome Linked List
- 【LeetCode】234. Palindrome Linked List
- [Leetcode]234. Palindrome Linked List
- 【leetcode】234. Palindrome Linked List
- 初识nodejs16
- Mac安装zsh&oh my zsh
- jq获得焦点focus,失去焦点blur,change()函数,js的onfocus,onblur,onchange()方法
- 树状数组模板
- Codeforces
- leetcode 234. Palindrome Linked List
- 【干货】python爬取《战狼2》电影短评论,生成图云
- 操作系统实验七实验报告
- vsftpd服务器不显示文件
- Python初步了解(七)
- Codeforces 853C Star sky(二维前缀和)
- 商场推出幸运抽奖活动
- Technology && Tools AllCodeRows
- 文档即编码(二):信息树(一)