码迷,mamicode.com
首页 >  
搜索关键字:list    ( 54897个结果
Problem Linked List Cycle II
Problem Description:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without u...
分类:其他好文   时间:2014-07-07 17:00:35    阅读次数:161
insertion Sort List (链表的插入排序) leecode java
逻辑简单,代码难写,基础不劳,leecode写注释不能出现中文,太麻烦,我写了大量注释,链表问题最重要的就是你那个指针式干啥的提交地址https://oj.leetcode.com/problems/insertion-sort-list//** * Definition for singly-li...
分类:编程语言   时间:2014-07-07 16:59:54    阅读次数:193
【Java集合源码剖析】Java集合框架
Java集合工具包位于Java.util包下,包含了很多常用的数据结构,如数组、链表、栈、队列、集合、哈希表等。学习Java集合框架下大致可以分为如下五个部分:List列表、Set集合、Map映射、迭代器(Iterator、Enumeration)、工具类(Arrays、Collections)。 从上图中可以看出,集合类主要分为两大类:Collection和Map。 Collection是List、Set等集合高度抽象出来的接口,它包含了这些集合的基本操作,它主要又分为两大部分:List和...
分类:编程语言   时间:2014-06-30 10:14:17    阅读次数:188
LeetCode: Reorder List [143]
【题目】 Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For example, Given {1,2,3,4}, reorder it to {1,4,2,3}. 【题意】 给定一个链表L: L0→L1→…→Ln-1→Ln,对他重新排序成L...
分类:其他好文   时间:2014-06-30 10:11:14    阅读次数:158
排序(5)---------快速排序(C语言实现)
快速排序使用分治法(Divide and conquer)策略来把一个串行(list)分为两个子串行(sub-lists)。 步骤为: 1,从数列中挑出一个元素,称为 "基准", 2,重新排序数列,所有元素比基准值小的摆放在基准前面,所有元素比基准值大的摆在基准的后面(相同的数可以到任一边)。在这个分区退出之后,该基准就处于数列的中间位置。这个称为分区操作。 3,递归地把小于基准值元素的子数列和大于基准值元素的子数列排序。 4,递归的最底部情形,是数列的大小是零或一,也就是永远都已经被排序好了。虽然一直递...
分类:编程语言   时间:2014-06-30 08:19:12    阅读次数:203
验证list的底层数据结构
《STL源码剖析》中,指出SGI STL的list底层数据结构式循环双向链表,并且在链表尾端留一个空白节点,让end指向它。由于是双向的,那么list的迭代器必须是Bidirectional Iterator类别的。        下面,分别验证vs2010下和code blocks(gcc)下,list的底层实现是否是循环链表。 #include #include using namesp...
分类:其他好文   时间:2014-06-30 00:21:54    阅读次数:202
LeetCode: Linked List Cycle II [142]
【题目】 Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up: Can you solve it without using extra space? 【题意】 给定一个单向链表,如果链表有环,则返回环开始的位置。 【思路】 仍然是维护两个指针, p1, p2, p1每次走一步, p2每次走两步 ...
分类:其他好文   时间:2014-06-29 23:59:21    阅读次数:354
LeetCode: Linked List Cycle [141]
【题目】 Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? 【题意】 判断一个单向链表是否有环 【思路】 维护两个指针p1和p2,p1每次向前移动一步,p2每次向前移动两步 如果p2能够追上p1,则说明链表中存在环...
分类:其他好文   时间:2014-06-29 22:51:33    阅读次数:267
python 2
要取得一个对象的属性和方法用:dir()某方法的具体使用方法帮助用:help(list.pop)查看可调用字段的文档用:obj__doc__集合:无序排列、可hash支持集合算法。不支持:索引、切片、元素获取集合类型:set()可变集合。frozenset()不可变集合。(frozen冻结的)集合没有特定语法格式..
分类:编程语言   时间:2014-06-29 21:56:13    阅读次数:221
LeetCode: Copy List with Random Pointer [138]
【题目】 A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list. 【题意】 给定一个链表,每个节点除了next指针外,还有一个random指针,指向任意的节点。 要求,复制这样的一个链表 【思路】 思路...
分类:其他好文   时间:2014-06-29 20:41:21    阅读次数:232
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!