/* 折半查找 */ /* 输出:9 */ static int BinarySearch(int [] a, int n, int key){ int low, high, mid; low = 0; high = n; while(low <= high){ mid = (low + high) ...
分类:
其他好文 时间:
2018-06-09 13:16:29
阅读次数:
132
算法简介 折半插入排序(binary insertion sort)是对插入排序算法的一种改进,由于排序算法过程中,就是不断的依次将元素插入前面已排好序的序列中。由于前半部分为已排好序的数列,这样我们不用按顺序依次寻找插入点,可以采用折半查找的方法来加快寻找插入点的速度。 算法动态演示: 算法思想 ...
分类:
编程语言 时间:
2018-06-09 11:37:16
阅读次数:
223
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes ...
分类:
其他好文 时间:
2018-06-09 10:17:55
阅读次数:
230
pwn加载题目给定的so ~~~python from pwn import import sys, os def change_ld(binary, ld): """ Force to use assigned new ld.so by changing the binary """ if not ...
分类:
其他好文 时间:
2018-06-09 00:50:06
阅读次数:
396
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes ...
分类:
其他好文 时间:
2018-06-09 00:03:48
阅读次数:
127
原题网址:https://www.lintcode.com/problem/minimum-depth-of-binary-tree/description 描述 给定一个二叉树,找出其最小深度。 二叉树的最小深度为根节点到最近叶子节点的距离。 描述 描述 给定一个二叉树,找出其最小深度。 二叉树的 ...
分类:
其他好文 时间:
2018-06-08 23:19:03
阅读次数:
312
An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any ...
分类:
其他好文 时间:
2018-06-08 22:10:30
阅读次数:
190
两种递归写法 第一种递归,通过循环找准当前节点 第二种递归,通过递归调用本身来找到当前节点 ...
分类:
其他好文 时间:
2018-06-08 22:01:03
阅读次数:
167
SQL Server读懂语句运行的统计信息 SET STATISTICS TIME IO PROFILE ON 对于语句的运行,除了执行计划本身,还有一些其他因素要考虑,例如语句的编译时间、执行时间、做了多少次磁盘读等。 如果DBA能够把问题语句单独测试运行,可以在运行前打开下面这三个开关,收集语句 ...
分类:
数据库 时间:
2018-06-08 16:39:01
阅读次数:
202
Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1 ... n. 输出1~n能生成的所有BST。 首先是BST的生成方法。根据BST的特性(若有左子树 ...
分类:
其他好文 时间:
2018-06-08 14:23:54
阅读次数:
134