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7b0GRk/ZB1iRJiphxb5Bel5l/X7GXapG6aeMozIt30+vlqnC22+4Q3vkqte54840DiemKLu37bkdqgyfslZ6829zWX6JkurzzqbwBYMrwxSTNqctuAACAmUJ4AwAAeAbhDQAA4BmENwAAgOpgthYAAABSSURBVGcQ3gAAAJ5BeAMAAHgG4Q0AAOAZhDcAAIBnEN4AAACeQXgDAAB4BuENAADgGYQ3AACAZxDeAAAAnkF4AwAAeAbhDQAA4BmENwAAgGf8P/9zmyqvwPDCAAAAAElFTkSuQmCC" alt="" />
/*
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};*/
class Solution {
public:
ListNode* FindKthToTail(ListNode* pListHead, unsigned int k)
{
if (k <= ||!pListHead) return NULL;
ListNode* p1 = pListHead;
ListNode* p2 = pListHead;
//p1向前移动到第k个节点,即移动k-1次
for (int i = ;i < k;i++)
{
p1 = p1->next;
if (p1 == NULL)
return NULL;
}
//当p1移动到最后一个节点的时候,p2正好移动到倒数第k个节点
while (p1->next != NULL)
{
p1 = p1->next;
p2 = p2->next;
}
return p2;
}
};
2.2链表 链表中倒数第k个结点的更多相关文章
- 剑指offer四:链表中倒数第k个结点
输入一个链表,输出该链表中倒数第K个结点 public class ListNode { int val; ListNode next = null; ListNode(int val) { this ...
- 剑指Offer 链表中倒数第k个结点
题目描述 输入一个链表,输出该链表中倒数第k个结点. 思路: 法1:设置2个指针p,q.p先移动k次,然后pq同时后移,p到链表尾尾的时候,q指向倒数第k个节点. 注意://需要考虑k=0,以 ...
- 【编程题目】输入一个单向链表,输出该链表中倒数第 k 个结点
第 13 题(链表):题目:输入一个单向链表,输出该链表中倒数第 k 个结点.链表的倒数第 0 个结点为链表的尾指针.链表结点定义如下: struct ListNode {int m_nKey;Lis ...
- 输出单向链表中倒数第k个结点
描述 输入一个单向链表,输出该链表中倒数第k个结点,链表的倒数第0个结点为链表的尾指针. 链表结点定义如下: struct ListNode { int m_nKey; ListNode* ...
- 找出链表中倒数第 k 个结点
/* 题目:输入一个单向链表,输出该链表中倒数第 k 个结点.链表的倒数第 0 个结点为链表 的尾指针. 链表结点定义如下: struct node { int data; struct node * ...
- 链表中倒数第k个结点
题目: 输入一个链表,输出该链表中倒数第k个结点. 思路: 因为是单向链表,如果使用最普通的遍历来解决的话会多出很多不必要的遍历.有一个比较好的解法,设置两个指针两个指针之间差k-1个位置,也就是当后 ...
- IT公司100题-13-求链表中倒数第k个结点
问题描述: 输入一个单向链表,输出该链表中倒数第k个结点.链表倒数第0个节点为NULL. struct list_node { int data; list_node* next; }; 分析: 方法 ...
- 剑指Offer:面试题15——链表中倒数第k个结点(java实现)
问题描述 输入一个链表,输出该链表中倒数第k个结点.(尾结点是倒数第一个) 结点定义如下: public class ListNode { int val; ListNode next = null; ...
- (剑指Offer)面试题15:链表中倒数第k个结点
题目: 输入一个链表,输出该链表中倒数第k个结点. 例如:链表中有6个结点,从头到尾依次为1,2,3,4,5,6,则该链表的倒数第3个结点为4. 链表结点定义: struct ListNode{ in ...
- 【面试题015】链表中倒数第k个结点
[面试题015]链表中倒数第k个结点 可以用两个指针,当第一个指针指向了第k个时候,第二个指针让他指向链表的第一个元素,然后这两个指针同时向后面移动, 当第一个指针移动到末尾的时候,第二个指针指 ...
随机推荐
- SilverLight.3-Validation:二、银光验证。TheLabel、TheDescriptionViewer和TheValidationSummary
ylbtech-SilverLight.3-DataControls_BetterDataFroms:二.银光验证.TheLabel.TheDescriptionViewer和TheValidatio ...
- Jboss7类载入器
1. 类载入器理论知识介绍 类载入器基于Jboss Module,代替了层次类载入环境,避免了当类存在多个版本号时,导致类载入错误. 类载入是基于模块的.必须显示的定义模块依赖.部署也是模块化的,假设 ...
- Maven引入Hadoop依赖报错:Missing artifact jdk.tools:jdk.tools:jar:1.6
Maven引入Hadoop依赖报错:Missing artifact jdk.tools:jdk.tools:jar:1.6 原因是缺少tools.jar的依赖,tools.jar在jdk的安装目录中 ...
- mysql 远程登陆不上
当使用 TCP/IP 连接 mysql 时, 出现 : Can't connect to MySQL server on 'xxx.xxx.xxx.xxx.'(111) 这个错误. 经过重复折腾: 确 ...
- Linux系统编程_1_文件夹读取(实现简单ls命令)
闲来无事.随便写写,实现简单的ls命令: | 1 #include <stdio.h> | 2 #include <stdlib.h> | 3 #include <dir ...
- vuex Payload 荷载
1.payload payload:有效载荷,即记录有效信息的部分. 通常在传输数据时,为了使数据传输更可靠,要把原始数据分批传输,并且在每一批数据的头和尾都加上一定的辅助信息,比如这一批数据量的大小 ...
- Vue 渲染优先级
当 v-if 与 v-for 一起使用时,v-for 具有比 v-if 更高的优先级.
- .netMVC:Web页面向后台提交数据的方式和选择
众所周知Web前端页面主要由HTML/CSS/Javascript组成,当要通过与用户的交互实现各种功能时,就需要向后台提交一些数据或者操作.在Web世界里各种实现眼花缭乱,但究其根本,不外乎三种方式 ...
- ios 视图的旋转及应用
有时候,需要做出如下图所示的效果,这就需要用到视图的旋转了 1.首先将旋转的值由角度转换为弧度: #define degreesToRadinas(x) (M_PI * (x)/180.0) 注:M_ ...
- hdu 1203 I NEED A OFFER!(01背包)
题意:"至少一份offer的最大概率".即求拿不到offer的最小概率 (得到offer的最大概率 = 1 - 反例的最小概率). 状态转移方程:dp[j]= Min(dp[j], ...