上一页 1 2 3 4 5 6 ··· 12 下一页
摘要: class insertionsort(): def insertion_sort(self,Array): for i in range(1, len(Array)): key = Array[i] j = i - 1 ... 阅读全文
posted @ 2014-08-15 14:15 南郭子綦 阅读(432) 评论(0) 推荐(0) 编辑
摘要: 最简单的不相交集的实现,来自MAW的《数据结构与算法分析》。代码:class DisjSet: def __init__(self, NumSets): self.S = [0 for i in range(NumSets+1)] def SetUnion(self, S,... 阅读全文
posted @ 2014-06-17 11:09 南郭子綦 阅读(601) 评论(0) 推荐(0) 编辑
摘要: 二叉树的插入与删除,来自Mark Allen Weiss的《数据结构与算法分析》。# Definition for a binary tree nodeclass TreeNode: def __init__(self, x): self.val = x self... 阅读全文
posted @ 2014-06-16 22:23 南郭子綦 阅读(2133) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/add-two-numbers/题意:You are given two linked lists representing two non-negative numbers. The digits are stored i... 阅读全文
posted @ 2014-06-13 16:06 南郭子綦 阅读(9034) 评论(3) 推荐(1) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/题意:Given a string, find the length of the longest substring witho... 阅读全文
posted @ 2014-06-13 14:56 南郭子綦 阅读(5110) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/reverse-nodes-in-k-group/题意:Given a linked list, reverse the nodes of a linked listkat a time and return its mod... 阅读全文
posted @ 2014-06-13 12:06 南郭子綦 阅读(3191) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/submissions/detail/5341904/题意:The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of ... 阅读全文
posted @ 2014-06-13 11:48 南郭子綦 阅读(4697) 评论(0) 推荐(1) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/merge-two-sorted-lists/题意:Merge two sorted linked lists and return it as a new list. The new list should be made... 阅读全文
posted @ 2014-06-13 11:26 南郭子綦 阅读(6646) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/rotate-list/题意:Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2... 阅读全文
posted @ 2014-06-13 11:19 南郭子綦 阅读(3690) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/minimum-window-substring/题意:Given a string S and a string T, find the minimum window in S which will contain all... 阅读全文
posted @ 2014-06-13 11:02 南郭子綦 阅读(4914) 评论(4) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/unique-paths-ii/题意:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many ... 阅读全文
posted @ 2014-06-13 09:57 南郭子綦 阅读(2957) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/unique-paths/题意:A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The ... 阅读全文
posted @ 2014-06-13 09:43 南郭子綦 阅读(3421) 评论(1) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/maximal-rectangle/题意:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all... 阅读全文
posted @ 2014-06-12 16:53 南郭子綦 阅读(3134) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/largest-rectangle-in-histogram/题意:Givennnon-negative integers representing the histogram's bar height where the ... 阅读全文
posted @ 2014-06-12 15:12 南郭子綦 阅读(4602) 评论(0) 推荐(0) 编辑
摘要: 原题地址:https://oj.leetcode.com/problems/decode-ways/题意:A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -... 阅读全文
posted @ 2014-06-12 14:33 南郭子綦 阅读(5253) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 12 下一页