
Algorithm
文章平均质量分 69
Stephen.W
life is full of unknown
展开
-
数据结构-树
二叉树 每个结点最多有两颗子树,结点的度最大为2 左子树和右子树是有顺序的,次序不能颠倒 节点数为n的树 深度至多为n 至少为log2(n+1)向下取整 对于任何一棵非空的二叉树,如果叶节点个数为n0,度数为2的节点个数为n2,则有: n0 = n2 + 1 存储二叉树结构的方法一般有三种,数组、链表、游标 满二叉树 高度为h的满二叉树拥有刚刚好(2^h+1 )-1个节点 ...原创 2017-12-19 23:35:33 · 306 阅读 · 0 评论 -
动态规划之01背包问题及leetcode实例
01背包问题 这篇文章讲的很清楚,我这里就不赘述了。 https://www.cnblogs.com/Christal-R/p/Dynamic_programming.html leetcode problem 416 描述 Given a non-empty array containing only positive integers, find if the array原创 2018-01-24 15:07:37 · 17809 阅读 · 0 评论 -
Manacher's algorithm求最长子回文串算法解析
Manacher’s algorithm 求最长子回文串 用该算法求解最长回文子串,时间和空间复杂度都是O(n)。 这里有篇英文解释,可供参考。算法不太好理解,所以在理解的时候记录下来,怕遗忘。 https://articles.leetcode.com/longest-palindromic-substring-part-ii/ 算法思想 1. 准备 首先,对回文子串做处理...原创 2018-03-13 13:11:30 · 352 阅读 · 0 评论 -
leetcode之wordsearch
Problem Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where “adjacent” cells are those horizontally or ver...原创 2017-12-23 11:30:14 · 396 阅读 · 0 评论 -
【算法】你真的会二分查找吗?(结合leetcode)
转载请注明出处。 写这篇文章的初衷是因为leetcode遇到了一个坑。我们先一起来看看。 leetcode 34 Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. Your algorithm’s ...原创 2018-05-05 13:20:17 · 914 阅读 · 0 评论