码迷,mamicode.com
首页 >  
搜索关键字:list dict    ( 58606个结果
leetcode -day19 Convert Sorted List to Binary Search Tree
1、 ?? Convert Sorted List to Binary Search Tree  Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 分析:将一个升序排列的链表转换为平衡二叉搜索树,采用递归的方式,先找到链表...
分类:其他好文   时间:2014-05-22 12:33:30    阅读次数:270
CareerCup之2.1无序链表删除重复元素
【题目】 原文: 2.1 Write code to remove duplicates from an unsorted linked list. FOLLOW UP How would you solve this problem if a temporary buffer is not allowed? 译文: 从一个未排序的链表中移除重复的项 ...
分类:其他好文   时间:2014-05-22 12:04:13    阅读次数:196
C++ list模板类介绍
简介          List是一种可在常数时间内在任何位置执行插入和删除操作的顺序容器。list是双向链表,其迭代器是双向的。与其他顺序容器(array, vector, deque)相比,list容器在任意位置执行插入、提取、和移动元素的操作更高效,但它不能通过在容器中的位置直接获取元素。 成员函数 复制控制 list::list()  ...
分类:编程语言   时间:2014-05-22 11:44:49    阅读次数:433
[LeetCode]Remove Nth Node From End of List
Remove Nth Node From End of List删除链表倒数的第N个元素...
分类:其他好文   时间:2014-05-22 11:15:52    阅读次数:170
CareerCup之2.2 寻找单链表倒数第n个元素
【题目】 原文: 2.2 Implement an algorithm to find the nth to last element of a singly linked list. 译文: 实现一个算法从一个单链表中返回倒数第n个元素。 【分析】 【思路一】 (1)创建两个指针p1和p2,指向单链表的开始节点。 (2)使p2移动n-1个位置,使之指向从头...
分类:其他好文   时间:2014-05-22 09:03:53    阅读次数:315
leetcode:Reorder List
问题 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}, reorde...
分类:其他好文   时间:2014-05-22 07:04:46    阅读次数:298
python中的数据结构
1.  列表 (1)   建立列表 list(‘python’) ['p', 'y', 't', 'h', 'o', 'n'] (2)列表的常用方法: append   在列表末尾添加元素 >>>l=[‘a’,’b’,’c’] >>>l.append(‘d’) >>>l ['a','b','c','d'] count   统计某个元素在列表中出现的次数 >>>['a','a'...
分类:编程语言   时间:2014-05-20 17:00:52    阅读次数:465
Java学习笔记_23_List接口实现类
23.List接口实现类:  List接口继承了Collection接口,它是一个允许存在重复项的有序集   合。  1>实现类ArrayList:   ArrayList类支持可随需要而增长的动态数组。数组列表以一个原大小被创建,当超过了它的大小,   类集自动增大,当对象被删除后,数组就可以缩小。   优点:ArrayList类对于使用索引取出元素用较高的效率,他可以用索引快速定位...
分类:编程语言   时间:2014-05-20 16:11:41    阅读次数:425
Leetcode:Merge Two Sorted Lists
戳我去解题Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.分析:直...
分类:其他好文   时间:2014-05-20 08:52:09    阅读次数:277
Leetcode:Remove Nth Node From End of List
戳我去解题Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. Aft...
分类:其他好文   时间:2014-05-20 08:04:28    阅读次数:291
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!