自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(6)
  • 收藏
  • 关注

原创 堆排序——python实现

   关于堆排序的详细讲解过程,见:http://www.cnblogs.com/MOBIN/p/5374217.html   下面是python 实现: def max_head(mylist, headsize, root_index): left = root_index*2+1 right =root_index*2+2 large_index = root...

2018-08-23 10:23:27 1858

原创 [LeeCode]搜索插入位置 Search Insert Position

Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.翻译:给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引。如果目标值不存在于数组...

2018-04-24 22:07:45 122

原创 [LeeCode27]移除元素Remove Element

给定一个数组 nums 和一个值 val,你需要原地移除所有数值等于 val 的元素,返回移除后数组的新长度。不要使用额外的数组空间,你必须在原地修改输入数组并在使用 O(1) 额外空间的条件下完成。元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。 def removeElement(self, nums, val): """ :type nums...

2018-04-24 21:39:34 130

原创 [LeetCode21]合并两个有序链表 (Merge Two Sorted Lists)

描述:将两个有序链表合并为一个新的有序链表并返回。新链表是通过拼接给定的两个链表的所有节点组成的。e.g.:输入:1->2->4, 1->3->4 输出:1->1->2->3->4->4 def mergeTwoLists(self, l1, l2): """ :type l1: ListNode ...

2018-04-24 21:10:25 127

原创 python2.7实现二叉树

from collections import deque #结点中定义数据,左右节点 class Node: def __init__(self,data=-1,lchild=None,rchild=None): self.data=data self.lchild=lchild self.rchild=rchild class Crea...

2018-04-24 20:06:33 118

原创 python2.7实现链表

1.基本链表实现:class Chain: def __init__(self,data,pnext=None): self.data=data self.pnext=pnext if __name__=='__main__': chain=Chain('A',Chain('B',Chain('C',Chain('D')))) while ...

2018-04-24 16:35:44 198

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除