自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 准确率(Accuracy), 精确率(Precision), 召回率(Recall)和F1-Measure

这篇博文讲的很清楚:https://argcv.com/articles/1036.c机器学习(ML),自然语言处理(NLP),信息检索(IR)等领域,评估(Evaluation)是一个必要的工作,而其评价指标往往有如下几点:准确率(Accuracy),精确率(Precision),召回率(Recall)和F1-Measure。(注:相对来说,IR 的 ground truth 很多时...

2017-02-13 14:44:00 257

转载 LeetCode-148. Sort List

148. Sort ListSort a linked list in O(n log n) time using constant space complexity.Solution利用归并排序的思想# Definition for singly-linked list.# class ListNode(object):# def __init__(self, x)...

2017-01-17 22:15:00 196

转载 LeetCode-160. Intersection of Two Linked Lists

160. Intersection of Two Linked ListsWrite a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a...

2017-01-03 21:47:00 215

转载 LeetCode-328. Odd Even Linked List

328. Odd Even Linked ListGiven a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes...

2017-01-03 17:17:00 262

转载 LeetCode-234. Palindrome Linked List

234. Palindrome Linked ListGiven a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?判断一个链表是不是回文的。Solution# Definition for singly-lin...

2017-01-03 12:00:00 119

转载 Trie树

Trie树:字典查找树。208. Implement Trie (Prefix Tree)Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of lowercase letters a-z.Solutioncl...

2016-12-28 20:39:00 114

转载 圆圈中最后剩下的数字

题目:n个数字(0,1,…,n-1)形成一个圆圈,从数字0开始,每次从这个圆圈中删除第m个数字(第一个为当前数字本身,第二个为当前数字的下一个数字)。当一个数字删除后,从被删除数字的下一个继续删除第m个数字。求出在这个圆圈中剩下的最后一个数字。Solution# -*- coding:utf-8 -*-class Solution: def LastRemaining_So...

2016-12-15 12:05:00 98

转载 LeetCode-215. Kth Largest Element in an Array

https://leetcode.com/problems/kth-largest-element-in-an-array/Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct...

2016-12-09 15:24:00 120

转载 n个骰子的和

剑指Offer:面试题43把n个骰子扔在地上,所有骰子朝上一面的点数之和为s。求s的所有可能值出现的次数。比如扔两个骰子,s的可能值为2-12,出现的次数分别为:1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1Solution# 在一次循环中,一个数组中的第n个元素表示骰子和为n出现的次数。# 在下一次循环中,加上一个新的骰子,此时和为n出现的次数等于上一次和为n...

2016-12-05 13:47:00 181

转载 DFS & BFS

图1.DFS & BFS深度优先算法:(1)访问初始顶点v并标记顶点v已访问。(2)查找顶点v的第一个邻接顶点w。(3)若顶点v的邻接顶点w存在,则继续执行;否则回溯到v,再找v的另外一个未访问过的邻接点。(4)若顶点w尚未被访问,则访问顶点w并标记顶点w为已访问。(5)继续查找顶点w的下一个邻接顶点wi,如果v取值wi转到步骤(3)。直到连通图中所有顶点全部访问过...

2016-12-02 20:11:00 96

转载 Rotated Sorted Array

有序数组旋转相关问题。153. Find Minimum in Rotated Sorted ArraySuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum...

2016-12-02 11:32:00 149

转载 二叉树 & 链表 常见问题总结

二叉树参考:http://blog.youkuaiyun.com/luckyxiaoqiang/article/details/7518888题目列表:求二叉树中的节点个数求二叉树的深度前序遍历,中序遍历,后序遍历分层遍历二叉树(按层次从上往下,从左往右)将二叉查找树变为有序的双向链表求二叉树第K层的节点个数求二叉树中叶子节点的个数判断两棵二叉树是否结构相同判断二叉树是不是平...

2016-12-01 16:56:00 211

转载 二叉树的镜像

101. Symmetric Tree判断一棵二叉树是不是镜像对称的。Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: ...

2016-11-30 13:03:00 113

转载 判断树B是不是树A的子结构

题意输入两棵二叉树A和B,判断B是不是A的子结构。Solution# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# self.ri...

2016-11-30 10:26:00 120

转载 LeetCode-21. Merge Two Sorted Lists

合并两个已排序的链表。https://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 by splicing together the nodes of the firs...

2016-11-29 19:21:00 115

转载 LeetCode-Reverse Linked List I & II

两个链表反转问题。206. Reverse Linked ListReverse a singly linked list.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?Solutioniteratively# Definition...

2016-11-29 16:16:00 147

转载 LeetCode-Permutations & Permutations II

两个全排列问题。46. PermutationsGiven a collection of distinct numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,...

2016-11-28 16:28:00 158

转载 Linux常用命令

who 显示在线登陆用户whoami 显示当前操作用户hostname 显示主机名uname 显示系统信息top 动态显示当前耗费资源最多进程信息ps 显示瞬间进程状态 ps -auxdu 查看目录大小 du -h /home带有单位显示目录信息df 查看磁盘大小 df -h 带有单位显示磁盘信息ifconfig 查看网络情况ping 测试网络连通netstat 显示...

2016-11-27 15:21:00 119

转载 Mac OS 快捷键

系统快捷键shift+command+control+4/3 将指定区域/整个屏幕截图保存到粘贴板shift+command+4/3 将指定区域/整个屏幕截图保存到桌面command+q 退出程序command+w 关闭窗口command+n 新建窗口command+delete 移到废纸篓command+shift+v 无格式粘贴command+数字 切换标签页con...

2016-11-27 11:36:00 142

转载 Git 常用命令

参考资料1.常用 Git 命令清单2.Git常用命令备忘转载于:https://www.cnblogs.com/binwone/p/6106115.html

2016-11-27 11:25:00 115

转载 Python 中的exec & eval,执行字符串形式的代码

好处:如可以方便的直接将字符串形式的list,tuple转换成Python 中的list,tuple。具体见参考资料。参考资料Be careful with exec and eval in Python转载于:https://www.cnblogs.com/binwone/p/6105578.html...

2016-11-26 23:00:00 396

转载 北邮校园网命令行登录登出

登录curl –data “DDDDD=userId&upass=pwd&0MKKey=” http://10.3.8.211其中,userId和pwd分别代表学号和密码。登出curl http://10.3.8.211/F.htm或者输错密码或学号登陆失败直接退出登陆。参考资料1.curl命令登录校园网关2.curl 指令小结3.curl网站开发指南...

2016-11-24 20:42:00 1225

转载 Linux下的查找命令find/locate/which/whereis/type

Linux的查找命令有5个,分别如下:which:在PATH变量指定的路径中,搜索某个系统命令的位置,并且返回第一个搜索结果;type:用于区分某个命令到底是由shell自带的,还是由shell外部的独立二进制文件提供的。如果一个命令是外部命令,那么使用-p参数,会显示该命令的路径,相当于which命令。type命令其实不能算查找命令;whereis:只能用于程序名的搜索,而且只搜...

2016-11-24 16:10:00 235

转载 Sublime Text 3 中文乱码问题

Mac os 英文版下Sublime Text 3中文乱码问题command + shift + p : install package安装 ConvertToUTF8,Codecs33,gbk 三个包。参考:http://ju.outofmemory.cn/entry/219849转载于:https://www.cnblogs.com/binwone/p/6095362....

2016-11-23 21:13:00 67

转载 Linux下查看文件内容的命令cat/tac/nl/more/less/head/tail/vi

在Linux系统下,有很多命令可以查看文本文件的内容,如cat/tac/nl/more/less/head/tail等命令,当然还有vi/nano等文本编辑器。cat: 从第一行开始显示全部的文本内容;tac: 从最后一行开始,显示全部分文本内容,与cat相反;nl: 显示文本时,可以输出行号;more: 按页显示文本内容;less: 与more差不多,也是按页显示文本内容,区...

2016-11-23 20:23:00 330

转载 Markdown语法

参考资料1.Mastering Markdown2.在stackoverflow上使用markdown3.Markdown Cheatsheet转载于:https://www.cnblogs.com/binwone/p/6092958.html

2016-11-23 11:21:00 91

转载 LeetCode-191. Number of 1 Bits

https://leetcode.com/problems/number-of-1-bits/Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-b...

2016-11-21 22:14:00 149

转载 递归 VS 迭代

递归代码简洁。递归的缺点:1.递归是函数调用自身,函数调用有时间和空间的消耗:每一次函数调用,都需要在内存栈中分配空间已保存参数,返回地址及临时变量,而且往栈里压入数据和弹出数据都需要时间。2.递归中有很多计算都是重复的(对存在重叠子问题的情形),从而对性能带来很大影响。比如:计算佩波拉契数列问题。3.递归次数过多会存在调用栈溢出的问题!参考:《剑指Offer》转载于:h...

2016-11-21 21:18:00 79

转载 LeetCode-Find Minimum in Rotated Sorted Array I & II

153. Find Minimum in Rotated Sorted ArraySuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).Find the minimum element.Yo...

2016-11-21 17:11:00 128

转载 LeetCode-61. Rotate List

https://leetcode.com/problems/rotate-list/Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return...

2016-11-21 17:01:00 128

转载 栈和队列

1.用两个栈实现队列232.Implement Queue using StacksImplement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front...

2016-11-20 18:25:00 70

转载 Markdown中插入Latex公式

使用MathJax引擎输入:$$x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}$$显示:\[x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}\]参考资料:1.MathJax basic tutorial and quick reference2.Mathjax与LaTex公式简介3.markdown语法之如何使用LaTeX语法编写数学公式4...

2016-11-17 15:13:00 432

转载 重建二叉树

已知先序遍历和中序遍历及已知中序遍历和后序遍历重建二叉树的Python递归和迭代解法105. Construct Binary Tree from Preorder and Inorder Traversalhttps://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/...

2016-11-15 22:13:00 92

转载 LeetCode-Path Sum I & II & III

112. Path Sumhttps://leetcode.com/problems/path-sum/Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the giv...

2016-11-12 10:43:00 119

转载 LeetCode-Unique Binary Search Trees I & II

96. Unique Binary Search Treeshttps://leetcode.com/problems/unique-binary-search-trees/Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Gi...

2016-11-11 22:16:00 142

转载 LeetCode-230. Kth Smallest Element in a BST

https://leetcode.com/problems/kth-smallest-element-in-a-bst/Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note:You may assume k is always vali...

2016-11-10 21:20:00 98

转载 LeetCode-98. Validate Binary Search Tree

https://leetcode.com/problems/validate-binary-search-tree/Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node...

2016-11-10 21:16:00 80

转载 LeetCode-450. Delete Node in a BST

https://leetcode.com/problems/delete-node-in-a-bst/Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated...

2016-11-10 20:27:00 115

转载 LeetCode-108. Convert Sorted Array to Binary Search Tree

https://leetcode.com/problems/convert-sorted-array-to-binary-search-tree/Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Solution# Definition f...

2016-11-10 19:53:00 105

转载 LeetCode-129. Sum Root to Leaf Numbers

https://leetcode.com/problems/sum-root-to-leaf-numbers/Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1...

2016-11-10 16:27:00 148

空空如也

空空如也

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

TA关注的人

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