tina_tian1的博客

私信 关注
tina_tian1
码龄6年

静观其变,顺其自然

  • 200,268
    被访问量
  • 191
    原创文章
  • 25,454
    作者排名
  • 6
    粉丝数量
  • 于 2015-08-04 加入CSDN
获得成就
  • 获得25次点赞
  • 内容获得3次评论
  • 获得37次收藏
荣誉勋章
TA的专栏
  • C++
    9篇
  • Python
    12篇
  • Linux
    30篇
  • QT
    2篇
  • Boost
    2篇
  • Database
    7篇
  • Git
    11篇
  • Agile
    1篇
  • Redis
    1篇
  • Windows
    4篇
  • Design Patterns
    4篇
  • Summary
  • Java
    22篇
  • Algorithm
    23篇
  • Could
    4篇
  • Tool
    4篇
  • AngularJS
    5篇
  • NodeJS
    4篇
  • JavaScript
    9篇
  • Network
    1篇
  • CS Basic
    2篇
  • Bit Operation
    11篇
  • 读书笔记
  • Machine Learning
    2篇
  • Block Chain
    13篇
  • Other
    3篇
  • Math
    3篇
  • 最近
  • 文章
  • 资源
  • 问答
  • 课程
  • 帖子
  • 收藏
  • 关注/订阅

Shell 操作符

文章目录Shell 操作符SummaryOperatorPracticeShell 操作符SummaryOperator定义说明举例备注普通变量$((运算式))result=$(((2+5)*5))$[运算式]result=$[(2+5)*5]`expr 运算式`tmp=`expr 2 + 5`注意必须有空格result=`expr $tmp \* 5`注意*号要转义Otherif [ condition
原创
65阅读
0评论
0点赞
发布博客于 9 月前

进程管理 Process Management

文章目录Process ManagementSummaryPracticeps auxps -elfpstree -u 显示进程所属用户pstree -p 显示进程的pidServiceSummaryservice firewalld status/ect/init.dvim /etc/inittabsystemctl get-default如果不小心将默认的运行级别设置成0或7,怎么处理chkconfig --listchkconfig idm --listchkconfig --level 2 idm
原创
83阅读
0评论
0点赞
发布博客于 9 月前

Shell 变量

文章目录Shell 变量Summary变量注释Practice普通变量`unset`定义静态变量 `readonly`命令返回值赋给变量 \`命令\` 或 $(命令)**参数变量**预定义变量Shell 变量Summary变量定义说明举例备注普通变量=定义A=“test”注意不能有空格unset撤销unset Areadonly静态变量readonly A=“test”`命令`赋给变量命令返回值RESULT=`ls -l /
原创
60阅读
0评论
0点赞
发布博客于 9 月前

Virtualbox Linux 和 Window 10共享文件夹

文章目录Virtualbox Linux 和 Window 10共享文件夹1. windows 10创建文件夹`C:\Workshop\sharedwindows`2. virtualbox 上添加Shared Folder3. Linux Cenos 上执行如下操作4. 可以相互创建文件进行验证Virtualbox Linux 和 Window 10共享文件夹1. windows 10创建文件夹C:\Workshop\sharedwindows2. virtualbox 上添加Shared Fold
原创
124阅读
0评论
0点赞
发布博客于 9 月前

intellij notes

List item文章目录Intellij NotesReference :Settingshort cut : `Ctrl `+ `Alt` + `S`auto import package :show method separatorspostfix completionchange font size by mouseshow quick doc on mouse movecase in...
原创
51阅读
0评论
0点赞
发布博客于 1 年前

Markdown Sample

文章目录Summary1. 加粗2. Markdown中如何添加特殊符号3. Markdown数学公式语法空格4. 字体颜色字体背景色5. Jump1. local file1.1 way 11.2 way 22. Other file3. Link6. 脚标7. 删除线8.快捷方式9. List10 分割线11 特殊字符12 . 引用13 . 表格14. 首行缩进15. 表情符号16. 文本居...
原创
83阅读
0评论
0点赞
发布博客于 1 年前

11. Container With Most Water

文章目录11. Container With Most WaterApproache 1 : DP - Left And Right PointsSummary :1. Consider all combinations of i and j, optimize unnecessary parts (blue).11. Container With Most Waterhttps://lee...
原创
41阅读
0评论
0点赞
发布博客于 1 年前

Flyway Setting and Table Info

文章目录Flyway Setting and Table Info1. Dependencies2. Configuration3. Table Name flyway_schema_history4. LogFlyway Setting and Table Info1. Dependencies <dependency> <group...
原创
79阅读
0评论
0点赞
发布博客于 1 年前

Generate asciidoc

文章目录Generate asciidoc1. Dependencies2. Plugin3. Code SampleGenerate asciidoc1. Dependencies <dependency> <groupId>org.springframework.security</groupId> &l...
原创
72阅读
0评论
0点赞
发布博客于 1 年前

AsciiDoc Notes

Add ImageStep 1 : Add code below into .adoc fileimage::example.PNG[diagram]Step 2: Create an image file, in the specified folder, that is named after the AsciiDoc fileFor examplemission-cont...
原创
81阅读
0评论
0点赞
发布博客于 1 年前

384. Shuffle an Array

文章目录384. Shuffle an ArrayApproach 1 : Mark ElementComplexity AnalysisApproach 2 : Fish_YatesProof:Complexity AnalysisSummary1. Random Value2. Re-emphasize: [left-opened right-closed)3. Shuffle Method...
原创
38阅读
0评论
0点赞
发布博客于 1 年前

382. Linked List Random Node

文章目录382. Linked List Random NodeApproach 1 : Reservoir SamplingProof:Complexity Analysis382. Linked List Random Nodehttps://leetcode.com/problems/linked-list-random-node/Given a singly linked li...
原创
42阅读
0评论
0点赞
发布博客于 1 年前
程序员必须掌握的核心算法有哪些?
发布Blink于 1 年前
Markdown 实用技巧汇总
发布Blink于 1 年前

215. Kth Largest Element in an Array

文章目录215. Kth Largest Element in an ArrayApproach 1: Priority QueueApproach 2: Quick Select1. Swap low and high elementImprove performance (**16.55%** -> **99.39%**:smile:)2. Repeatly search high a...
原创
77阅读
0评论
0点赞
发布博客于 1 年前

Linked List Cycle 求链表是否有环及环的入口 证明

一. 问题: 求链表是否有环及环的入口二. leetcode 题目:142.Linked List Cycle IIhttps://leetcode.com/problems/linked-list-cycle-ii/Given a linked list, return the node where the cycle begins. If there is no cycl...
原创
98阅读
0评论
2点赞
发布博客于 1 年前

Java sort priority_queue map 比较函数

1. Sort1.1 自定义类型package test;import java.util.Comparator;import java.util.ArrayList;import java.util.Collections;import java.util.List;class MyComparator implements Comparator { public...
原创
53阅读
0评论
0点赞
发布博客于 2 年前

Java 强引用 软引用 弱引用 虚引用

1、强引用(StrongReference)如果一个对象具有强引用,那垃圾回收器绝不会回收它, 如new出来的对象。2、软引用(SoftReference)如果内存空间不足了,就会回收这些对象的内存。3、弱引用(WeakReference)GC一旦发现有弱引用的对象,不管当前内存空间足够与否,都会回收它的内存。4、虚引用(PhantomReference)纯摆设,虚引用...
原创
51阅读
1评论
0点赞
发布博客于 2 年前

关于Integer

1. 如何对List<Integer> result = new ArrayList<>(nums.length) result某个索引值进行修改?答案是不能,除非通过反射。原因是Integer中对value 的保存是不可修改的 private final int value;2. 如何交换两个Integer类型的值? public stat...
原创
45阅读
0评论
0点赞
发布博客于 2 年前

tomcat+jsp访问mysql

1. JDK 环境变量设置 (/etc/profile)export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64export JRE_HOME=${JAVA_HOME}/jre export JAVA_BIN=${JAVA_HOME}/bin export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HO...
原创
1155阅读
0评论
0点赞
发布博客于 2 年前

1143. Longest Common Subsequence

Given two stringstext1andtext2, return the length of their longest common subsequence.https://leetcode.com/problems/longest-common-subsequence/Solution:class Solution {public: int longe...
原创
83阅读
0评论
0点赞
发布博客于 2 年前

Ubuntu安装Nginx 并转发请求到Tomcat

一. 安装步骤1. apt update2. apt install nginx3. ufw app listAvailable applications: Nginx Full Nginx HTTP Nginx HTTPS OpenSSH4.ufw allow 'Nginx HTTP'5. systemctl status nginx二. 路径:...
原创
246阅读
0评论
0点赞
发布博客于 2 年前

KMP 算法

一.问题: 查找匹配字符串如从searchText = “fabfafabfab” 中找是否有匹配的字符串 pattern = “fabfab”二.算法: Solution 1: 暴力求解,每次移Solution 2: 快速移动其中next数组中的值为当前字符前的字符串(preSub)的最长的相同前缀后缀的长度,如pattern[5] = b. preSub...
原创
59阅读
0评论
0点赞
发布博客于 2 年前

647. Palindromic Substrings

DescriptionGiven a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes or end indexes are counted as different substrings even ...
原创
86阅读
0评论
0点赞
发布博客于 2 年前

tomcat上运行servlet

1. 创建Dynamic Web Project2. 创建servlet类和web.xml文件src下创建class HelloWorldpackage com.tx.servlet;import java.io.IOException;import java.io.PrintWriter;import javax.servlet.Servlet;import java...
原创
90阅读
0评论
0点赞
发布博客于 2 年前

ConcurrentHashMap 1.8 MyKey 验证BRTree

Java 1.7YanzhenJava 1.8public class MyKey implements Comparable<MyKey>{ public int key; @Override public int compareTo(MyKey o) { // TODO Auto-generated method stub Sys...
原创
86阅读
0评论
0点赞
发布博客于 2 年前

jstack 分析线程状态 - CPU占用100%

1. 现象CPU占用100%2. codepublic class JStack { public static void main(String[] args) { while (true) { //Do Nothing } }}3. 分析过程a. top 所有进程--- c ---u --sea...
原创
466阅读
0评论
0点赞
发布博客于 2 年前

密码技术

密码对称密码一次性密码本(One Time Pad)密钥的长度必须和明文的长度相等。明文大小100M,密钥也是无条件安全,理论上无法破译。midnight XOR otp1 = eotp1;eotp1 XOR otp1 = midnight;eopt1 XOR otp2 = standard;DES (Data Encryption Standard)不应再用...
原创
77阅读
0评论
0点赞
发布博客于 2 年前

Auth2 Practice - Authorization Code Type

1. Registration By Github.comInput information of the 3rd-part app as followingAddress:https://github.com/settings/applications/newClient ID and Client Secretcan be gotten as followin...
原创
73阅读
0评论
0点赞
发布博客于 2 年前

Auth2

1 INTRODUCTIONOAuth 2 is an authorization framework that enables applications to obtain limited access to user accounts on an HTTP service, such as Facebook, GitHub, and DigitalOcean. It...
原创
159阅读
0评论
0点赞
发布博客于 2 年前

ssh 端口转发笔记

From :https://www.ibm.com/developerworks/cn/linux/l-cn-sshforward/一. 概念SSH能够将其他 TCP 端口的网络数据通过 SSH 链接来转发,并且自动提供了相应的加密及解密服务。这一过程有时也被叫做“隧道”(tunneling)二. 两功能加密 SSH Client 端至 SSH Server 端之间的通讯数据。...
原创
229阅读
0评论
2点赞
发布博客于 2 年前

RISC 技术

原创
237阅读
0评论
0点赞
发布博客于 2 年前

浮点四则运算

原创
521阅读
0评论
1点赞
发布博客于 2 年前

定点运算 - 除法运算

原创
2785阅读
1评论
2点赞
发布博客于 2 年前

定点运算 - 乘法运算

原创
2357阅读
0评论
0点赞
发布博客于 2 年前

定点运算 - 加减法运算

原创
590阅读
0评论
0点赞
发布博客于 2 年前

定点运算 - 算术和逻辑移位

原创
291阅读
0评论
0点赞
发布博客于 2 年前

浮点数的表示

原创
71阅读
0评论
0点赞
发布博客于 2 年前

补码

重点关注红色字体部分。1. 为何补码数值为原码数值取反+1?两次加模, 如果数值位为n, 那么模为 2的n次方,两次加模为 2 的 n+1 次方2的 n+1 次方 = n+1个1 + 1如: 2 的 5次方 = 100000 = 11111 + 12. 更快捷计算补码的方式:原码从后向前查找左后是1的位置,此位置开始后边拷贝,前边取反,即为补码的数值部分...
原创
354阅读
0评论
0点赞
发布博客于 2 年前

牛顿莱布尼茨公式 几何解释

原创
4163阅读
0评论
0点赞
发布博客于 2 年前

Java 对称加密解密

import java.security.Key;import java.security.NoSuchAlgorithmException;import javax.crypto.Cipher;import javax.crypto.KeyGenerator;import javax.crypto.SecretKey;import javax.crypto.SecretKeyFa...
原创
83阅读
0评论
0点赞
发布博客于 2 年前

Java RabbitMQ

package com.dxc.cred.service;import com.dxc.cred.utils.ConnectionUtils;import com.rabbitmq.client.*;import org.hyperledger.indy.sdk.IndyException;import org.json.JSONException;import org.json.J...
原创
85阅读
0评论
0点赞
发布博客于 2 年前

Block Chain BTC 九 - 匿名性

原创
73阅读
0评论
1点赞
发布博客于 2 年前

Block Chain BTC 八 - 分叉

原创
104阅读
0评论
0点赞
发布博客于 2 年前

Block Chain BTC 七 - 挖矿

原创
101阅读
0评论
0点赞
发布博客于 2 年前

Block Chain BTC 六 - 挖矿难度

原创
391阅读
0评论
0点赞
发布博客于 2 年前

Block Chain BTC 五 - 网络

原创
61阅读
0评论
0点赞
发布博客于 2 年前

Block Chain BTC 四 - 实现

原创
54阅读
0评论
0点赞
发布博客于 2 年前

Block Chain BTC 三 - 协议

原创
55阅读
0评论
0点赞
发布博客于 2 年前

Block Chain BTC 二 - 数据结构

原创
85阅读
0评论
0点赞
发布博客于 2 年前

Block Chain - 密码学原理

原创
69阅读
0评论
0点赞
发布博客于 2 年前

网络地址命令

1. dhclient命令使用动态主机配置协议动态的配置网络接口的网络参数[root@prop-idm ~]# ps -elf | grep dhcp4 S root 787 708 0 80 0 - 28342 poll_s Mar27 ? 00:00:00 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-h...
原创
93阅读
0评论
0点赞
发布博客于 2 年前

Block Chain ETH 笔记二 智能合约

原创
112阅读
0评论
0点赞
发布博客于 2 年前

Block Chain ETH 笔记一

原创
67阅读
0评论
0点赞
发布博客于 2 年前

Block Chain BTC 笔记二

原创
69阅读
0评论
0点赞
发布博客于 2 年前

Block Chain BTC 笔记一 相关参数

1. 块大小: 1M2. 平均出块时间:10分钟3. nonce 取值空间 12 bytes = 2的96次方 header nonce 4 bytes + 块 coinbase 8 bytes (extra nonce)= 12bytes4. 总币数 = 2100万 21万*50 + 21万*25 + 21万*12.5 + ... = 21万*5...
原创
143阅读
0评论
0点赞
发布博客于 2 年前

Spring Boot 发送邮件

一. No Auth User1. Pom.xml 添加依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId>...
原创
41阅读
0评论
0点赞
发布博客于 2 年前

Spring Boot相关

1. 设置active profileEAD+xtian5@MINGW64 /c/Workshop/research/credential/credential/target (master)$ java -jar credential-0.0.1-SNAPSHOT.jar --spring.profiles.activ=devEAD+xtian5@MINGW64 /c/Works...
原创
49阅读
0评论
0点赞
发布博客于 2 年前

docker 命令记录

Docker 命令:docker build -f ci/indy-pool.dockerfile -t indy_pooldocker kill 6a6683e55c7edocker pssystemctl restart dockersystemctl daemon-reloadsystemctl restart dockerdocker imagesdocker kil...
原创
74阅读
0评论
0点赞
发布博客于 2 年前

反向传播链式求导法则

求导法则Sigmod函数求导
原创
2075阅读
0评论
0点赞
发布博客于 2 年前

Logistic regression梯度下降算法和代价函数求导

算法如下 代价函数求导如下 
原创
511阅读
1评论
0点赞
发布博客于 2 年前

postgres 执行计划 execution planing

1. 查询 通过索引查询idm_prod_20180405=# \d token_store;                   Table "public.token_store"        Column        |            Type             | Modifiers ----------------------+--------------...
原创
185阅读
0评论
0点赞
发布博客于 3 年前

MySQL Basic

1. MySQL 服务器逻辑架构图 2. 数据库事务正确(ACID)原子性(Atomicity)、一致性(Consistency)、隔离性(Isolation)、持久性(Durability)
原创
57阅读
0评论
0点赞
发布博客于 3 年前

Java 点滴

1. URLEncoder.encode(token, UTF_8)     token如果经过BASE64编码, 放入URL中,token会变,  客户端调用URLEncoder.encode(token, UTF_8)可解决问题,服务器会对url进行decode。 ...
原创
63阅读
0评论
0点赞
发布博客于 3 年前

Boyer-Moore算法

1. 算法  KMP从前往后搜索,BM txt从前往后,匹配时从后向前,right[R]为最右在pat出现的位置(base index=0). 其中Math.max(1, j-*), 是为了避免这种情况,当在pat中坏字符B的位置 小于 right[B]时,避免skip出现负值。 即坏字符B后还有B的情况。如下第二张图所示。2. right[R]的构建 3. 算法最...
原创
1763阅读
0评论
0点赞
发布博客于 3 年前

Performance tuning

 1. check db and find there are a million + records. and no index for the related tableidm_prod_20180405=# select relname as TABLE_NAME, reltuples as rowCounts from pg_class where relkind = 'r' or...
原创
98阅读
0评论
0点赞
发布博客于 3 年前

KMP算法

感受这是一个能看哭的算法,虽然没几行代码。起初是朋友一起看毛片,看了一个晚上,结果就是苦不堪言,不明觉厉。直到看到coursera上Robert Sedgewick的讲解,觉得神清气爽。后来,因为在看阮一峰的博客,又提到KMP,阮讲得道理好懂,但笼统。就想再对比下Robert教授的讲解,发现自己又傻住了。不得不再花了些时间,理解了一遍,还是记录下理解过程,希望以后不要再...
原创
125阅读
0评论
0点赞
发布博客于 3 年前

Kosaraju算法

原创
664阅读
0评论
0点赞
发布博客于 3 年前

Line Segment Intersections

From: https://people.scs.carleton.ca/~michiel/lecturenotes/ALGGEOM/horverintersect.pdf
转载
253阅读
0评论
0点赞
发布博客于 3 年前

Java intercepter

可以在controller 前进行拦截,但request wrapper 不可传给controller, 如果request body需要继续传递,可以使用filterimport java.io.IOException;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletR
原创
191阅读
0评论
0点赞
发布博客于 4 年前

Java - doFilter

解决问题:1. 在认证之前做个过滤InternalServerTokenFilter。如没有带内部token, 就不继续认证controller的处理了2. 过滤拿走request 的body后,controller不可再次消费,此时需要重新生成一个InternalServerTokenRequestWrapper, 可永久保存request body3. 过滤器需要捕捉异常,进行特殊处理返回给前
原创
438阅读
0评论
0点赞
发布博客于 4 年前

Jenkins && Pipeline Public/Private Key errors

1. Jenkins    test configuration failed:jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [prop-
原创
1857阅读
0评论
0点赞
发布博客于 4 年前

Java Integer 位操作 reverse

1.  O(logn) public static int reverse(int i) { // HD, Figure 7-1 i = (i & 0x55555555) >> 1) & 0x55555555; i = (i & 0x33333333) >> 2) & 0x33333333; i = (i & 0x0f0f0
原创
474阅读
0评论
0点赞
发布博客于 4 年前

Java Integer 位操作 numberOfTrailingZeros && numberOfLeadingZeros

numberOfTrailingZeros public static int numberOfTrailingZeros(int i) { // HD, Figure 5-14 int y; if (i == 0) return 32; int n = 31; y = i <<16; if (y != 0)
原创
1102阅读
0评论
0点赞
发布博客于 4 年前

位操作应用

1. 给定一个含不同整数的集合,返回其所有的子集S = {1,2,3}0 000 {}1 001 {1}2 010 {2}3 011 {1,2}4 100 {3}5 101 {1,3}6 110 {2,3}7 111 {1,2,3}class Solution { /** * @param S: A set of numbers. *
原创
166阅读
0评论
0点赞
发布博客于 4 年前

异或应用

又名: 不进位加法给出两个整数a和b, 求他们的和, 但不能使用 + 等数学运算符a + b = (a ^ b) + (a & b
原创
297阅读
0评论
0点赞
发布博客于 4 年前

vim 配色

1. downlowd from:https://github.com/altercation/vim-colors-solarized2. $ cd vim-colors-solarized/colors$ mkdir -p ~/.vim/colors$ cp solarized.vim ~/.vim/colors/$ vi ~/.vimrcsyntax enableset
原创
129阅读
0评论
0点赞
发布博客于 4 年前

sudo easy_install pip failed on Mac

1. Errorsetuptools-33.1.1     setuptools-33.1.1.zip➜  install sudo easy_install pipPassword:Traceback (most recent call last):  File "/usr/local/bin/easy_install", line 11, in     load_ent
原创
2466阅读
0评论
0点赞
发布博客于 4 年前

Window直接执行远程Linux命令

可直接通过git 的 bash.exe执行本地Windows:477_deploy.cmd文件内容如下:"C:\Program Files\Git\bin\bash.exe" -c 'scp /c/tmp/*.jar tiaxia@c9t26477.itcs.hpecorp.net:/home/tiaxia/'"C:\Program Files\Git\bin\bash.exe
原创
831阅读
0评论
0点赞
发布博客于 4 年前

异常 例子

1. 在 Java 中你可以自定义异常。编写自己的异常类时需要记住下面的几点。所有异常都必须是 Throwable 的子类。如果希望写一个检查性异常类,则需要继承 Exception 类。如果你想写一个运行时异常类,那么需要继承 RuntimeException 类。2 。如果一个方法没有捕获一个检查性异常,那么该方法必须使用 throws 关键字来声明。throw
原创
235阅读
0评论
0点赞
发布博客于 4 年前

Linux 基本三

1. 登录log  /var/log/secure    认证方式: 1.user/pwd 2. public/private key 3. krb5
原创
111阅读
0评论
0点赞
发布博客于 4 年前

Windows access Linux

Sample.cmd:ECHO ONdelete C:\tmp\*.jarCOPY "C:\Workspace\project\backend\VPC-IDM-service\idm-seeded\target\*.jar" "C:\tmp\""C:\Program Files\Git\bin\bash.exe" -c 'scp /c/tmp/*.jar root@192.168
原创
326阅读
0评论
0点赞
发布博客于 4 年前

send email using telnet

Open your command prompt.Now, connect with telnet using the following command:telnet example.com 25Type ehlo example.com. Some servers also accept helo in place of ehlo.ehlo example.comType ma
原创
422阅读
0评论
0点赞
发布博客于 4 年前

send mail by SMTP server (Python)

用新浪smtp 服务器import smtplibFROMADDR = "anit_nait@sina.com"LOGIN = FROMADDRPASSWORD = "xxxxxx"TOADDRS = ["xxx@sina.com","xxx@hpe.com"]SUBJECT = "hello world from smtp.sina.com server"msg =
原创
1262阅读
0评论
0点赞
发布博客于 4 年前

BRTree 删除Practice

原创
305阅读
0评论
0点赞
发布博客于 4 年前

Count of Smaller Numbers After Self

You are given an integer array nums and you have to return a new counts array.The counts array has the property where counts[i] is the number of smaller elements to the right ofnums[i].Example:
原创
170阅读
0评论
0点赞
发布博客于 4 年前

红黑树 RBTreee

1.  红黑树是二叉查找树.2.  插入性质:1. 插入新节点总是红色节点2. 如果插入节点的父节点是黑色, 能维持性质3. 如果插入节点的父节点是红色, 破坏了性质. 故插入算法就是通过重新着色或旋转, 来维持性质算法:假设要插入的节点标为N,N的父节点标为P,N的祖父节点标为G,N的叔父节点标为U.1. N = root, N->黑, over。2. P
原创
170阅读
0评论
1点赞
发布博客于 4 年前

二叉查找树

1. 查找Status SearchBST(BiTree T, KeyType key, BiTree f, BiTree &p){ if(!T) { //查找不成功 p=f; return false; } else if (key == T->data.key) { //查找成功 p=T; return true; } else if (
原创
173阅读
0评论
0点赞
发布博客于 4 年前

HighestBitNum

Java public static int highestOneBit(int i) { // HD, Figure 3-1 i |= (i >> 1); i |= (i >> 2); i |= (i >> 4); i |= (i >> 8); i |= (i >> 16);
原创
138阅读
0评论
0点赞
发布博客于 4 年前

树状树组

按照Peter M. Fenwick的说法,正如所有的整数都可以表示成2的幂和,我们也可以把一串序列表示成一系列子序列的和。采用这个想法,我们可将一个前缀和划分成多个子序列的和,而划分的方法与数的2的幂和具有极其相似的方式。一方面,子序列的个数是其二进制表示中1的个数,另一方面,子序列代表的f[i]的个数也是2的幂。三个概念1. Lowest bit number...
原创
245阅读
0评论
0点赞
发布博客于 4 年前

LowestBitNum

Given an integer, return an interger which has only one 1 bit, and the postion is as same as the lowest 1 bit of the input.返回输入最低位是1所在位置所代表的数。如 F(0001010) = 10 int x =0x80000000; int r1 = x&(x
原创
117阅读
0评论
0点赞
发布博客于 4 年前

Predict the Winner

Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a
原创
135阅读
0评论
0点赞
发布博客于 4 年前

随机数

Given a singly linked list, return a random node's value from the linked list. Each node must have thesame probability of being chosen. int getRandom() { int res = head->val; Li
原创
137阅读
0评论
0点赞
发布博客于 4 年前

算法笔记 - 数组

1. 排序可巧利用数组索引如:Given an array of 2n integers, your task is to group these integers into n pairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum of min(ai, bi) f
原创
573阅读
0评论
0点赞
发布博客于 4 年前

位操作

1. 二分法    a. 条件:low     b. 中值:mid = low + (high -low)/2. 数学推理一步可得:mid = (low+high)/2. 虽然看起来效率更高,注意有陷阱,越界。其他: a. 题目看清。b. 小于大于别误写。c. 概念要清,如后段和前段比较,不等时记录前段值,别记后段。
原创
147阅读
0评论
0点赞
发布博客于 4 年前

树的遍历 Tree traveral

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * ...
原创
485阅读
0评论
0点赞
发布博客于 4 年前

Jenkins on Linux(Master) talk with Windows server 2012 R2 (Slave)

1. Local server setting (Master )     a. Open http://c9t24783.itcs.hpecorp.net:8080 on Master     b. Click Manage Jenkins -> Manage Nodes -> New Node _>input node name ->ok             c.
原创
653阅读
0评论
0点赞
发布博客于 4 年前

protractor installation problems on Windows 2012 Server

Error 1.  Can't download chromeSolution: Local Server -> PROPERTIES -> IE Enhanced Security Configuration                  Set Off from On as below;Error 2.  connect ETIMEDOUT when run "webd
原创
421阅读
0评论
0点赞
发布博客于 4 年前

Promise Sample

function asyncFun(input) { var p = new Promise(function (resolve, reject) { setTimeout(function () { console.log('------------------------'); input+=" Time";
原创
481阅读
0评论
0点赞
发布博客于 4 年前

1的平方加到n的平方公式, 1的立方加到n的立方公式

证明:利用公式 (n-1)3= n3-3n2+3n-1S3 = 13+23+33+43+...+n3S2 = 12+22+32+42+...+n2S1 = 1 +2 +3 +4+...+n=>S3-3S2+3S1-n = (1-1)3+ (2-1)3+(3-1)3+ (4-1)3+ ... + (n-1)3=S3 -...
原创
17546阅读
0评论
3点赞
发布博客于 4 年前