上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 27 下一页
摘要: Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with another char... 阅读全文
posted @ 2017-03-27 23:46 xiejunzhao 阅读(229) 评论(0) 推荐(0)
摘要: Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of them... 阅读全文
posted @ 2017-03-24 22:36 xiejunzhao 阅读(206) 评论(0) 推荐(0)
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;/** * 插入排序 * **/namespace Algorithm { class InsertionSort where T:IComparable{ //插入排序 s... 阅读全文
posted @ 2017-03-23 23:31 xiejunzhao 阅读(240) 评论(0) 推荐(0)
摘要: int l = Int32.MaxValue;//2147483647int r = Int32.MaxValue;//2147483647Console.WriteLine((l + r)/2);//-1Console.WriteLine(l + (r - l) / 2);//2147483647null 阅读全文
posted @ 2017-03-23 23:20 xiejunzhao 阅读(370) 评论(0) 推荐(0)
摘要: 实现:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;/** * 二叉搜索树 * 一棵二叉搜索树是满足以下条件的二叉树 * 1.所有左节点的值都小于本节点的值 * 2.所有节点的值都小于右节点的值 **/namespace A... 阅读全文
posted @ 2017-03-20 00:09 xiejunzhao 阅读(496) 评论(0) 推荐(0)
摘要: 方法如下:如果x没有子节点,或者只有一个孩子,直接将x切下如果x有两个孩子,我们有其右子树中的最小值替换x,然后将左子树中的这一最小值切掉/*** 删除节点* */public BSTreeNode Delete(BSTreeNode t ,BSTreeNode x) { if (x == null) return Root; BSTreeNode root = t; BSTreeNode old... 阅读全文
posted @ 2017-03-19 22:41 xiejunzhao 阅读(1097) 评论(0) 推荐(0)
摘要: 前驱结点:节点val值小于该节点val值并且值最大的节点 后继节点:节点val值大于该节点val值并且值最小的节点 二叉树的节点val值是按照二叉树中序遍历顺序连续设定。前驱结点如图4的前驱结点是32的前驱结点是16的前驱结点是5后继节点7的后继结点是85的后继节点是62的后继节点是3前驱节点若一个节点有左子树,那么该节点的前驱节点是其左子树中val值最大的节点(也就是左子树中所谓的rightMo... 阅读全文
posted @ 2017-03-19 12:29 xiejunzhao 阅读(8116) 评论(0) 推荐(2)
摘要: Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.Strings consists of lowercase English letters only and the length of both strings s and p will not be larger ... 阅读全文
posted @ 2017-03-15 23:01 xiejunzhao 阅读(173) 评论(0) 推荐(0)
摘要: 参考资料:http://blog.csdn.net/v_july_v/article/details/7041827#t10 3.3.6 基于《最大长度表》与基于《next 数组》等价 我们已经知道,利用next 数组进行匹配失配时,模式串向右移动 j - next [ j ] 位,等价于已匹配字符数 - 失配字符的上一位字符所对应的最大长度值。原因是:j 从0开始计数,那么当数到失配字符时... 阅读全文
posted @ 2017-03-12 12:07 xiejunzhao 阅读(242) 评论(0) 推荐(0)
摘要: In LLP world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascending time series towards Ashe and the poisoning tim... 阅读全文
posted @ 2017-03-11 22:06 xiejunzhao 阅读(151) 评论(0) 推荐(0)
上一页 1 ··· 13 14 15 16 17 18 19 20 21 ··· 27 下一页