1.归并两个有序链表 2.最小路径和 3.计算int sqrt(x) 4. ...
分类:
编程语言 时间:
2017-04-21 00:26:24
阅读次数:
166
一、描述: 二、思路: 两个有着相同排序类型(降序或升序)的链表,合并为一新的链表,并且要求有序(和两个子链表的排序相同); 判断2个子链表是否为空,若有空链表,则返回另一不为空的链表; 两者均不为空,判断链表结点值val的大小,(此处应该有2中排序结果,大—>小 或 小—>大),该题中提交只接受 ...
分类:
其他好文 时间:
2017-04-15 13:31:57
阅读次数:
136
02-线性结构1 两个有序链表序列的合并 (15分) 编译器:gcc <!--Regular if2711--> 时间限制:400ms 内存限制:64MB 代码长度限制:16kB 判题程序:系统默认<!--Regular if2712--> 作者:DS课程组 单位:浙江大学 https://pta. ...
分类:
其他好文 时间:
2017-04-12 20:42:08
阅读次数:
254
笔记和代码的思路来源: 好大学慕课浙江大学陈越、何钦铭的《数据结构》 1 #include <stdio.h> 2 #include <stdlib.h> 3 4 typedef int ElementType; 5 typedef struct Node *PtrToNode; 6 struct ...
分类:
其他好文 时间:
2017-03-31 21:44:51
阅读次数:
163
Merge two sorted (ascending) linked lists and return it as a new sorted list. The new sorted list should be made by splicing together the nodes of the ...
分类:
其他好文 时间:
2017-01-03 08:11:47
阅读次数:
178
1. 数据结构部分
数据结构中常用的操作的效率表
通用数据结构
查找
插入
删除
遍历
数组
O(N)
O(1)
...
分类:
编程语言 时间:
2016-11-19 13:34:53
阅读次数:
212
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 分析: 根据一个有序链表,得到一个平衡二叉搜索树,主要是根据快慢指针得到链表的中 ...
分类:
其他好文 时间:
2016-11-12 23:04:52
阅读次数:
202
Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given 1->1->2, return 1->2. Given 1->1->2->3-> ...
分类:
其他好文 时间:
2016-10-25 01:55:50
阅读次数:
213
通过捕捉键盘动作来进行交互,头文件为conio.h,是console input output的缩写,捕捉用户键盘按键的函数为getch(),通过键值码可以找到对应的按键。 #include<stdio.h> #include<string.h> #include<stdlib.h> #includ ...
分类:
其他好文 时间:
2016-10-16 19:12:04
阅读次数:
251
一,问题描述 请自己构造一个简单的有序单链表,然后实现删除链表中的重复结点。比如: 二,问题分析 首先要实现一个单链表,因此需要定义一个节点类Node。其次,实现向链表中添加结点的方法(使用尾插法)addNode 删除重复结点的实现思路: 定义两个指针:pre 和 next。初始时,pre指向链表中 ...
分类:
其他好文 时间:
2016-09-30 09:41:52
阅读次数:
137