Algorithm
二叉樹根據(jù)值刪除節(jié)點(diǎn)
public void remove(E e) {
root = remove(root, e);
}
private Node remove(Node node, E e) {
if (node == null) {
return null;
}
if (e.compareTo(node.e) < 0) {
node.left = remove(node.left,e);
return node;
}else if (e.compareTo(node.e) > 0){
node.right = remove(node.right,e);
return node;
}else {
if (node.left == null){
Node rightNode = node.right;
size--;
node.right = null;
return rightNode;
}
if (node.right == null){
Node leftNode = node.left;
size--;
node.left = null;
return leftNode;
}
Node successor = removeMin(node.right);
successor.left = node.left;
successor.right = node.right;
node.left = node.right = null;
return successor;
}
}
public E removeMin() {
E minnum = mininum();
root = removeMin(root);
return minnum;
}
private Node removeMin(Node node) {
if (node.left == null) {
Node childRight = node.right;
node.right = null;
size--;
return childRight;
}
node.left = removeMin(node.left);
return node;
}
Review
Flink自定義TableSource和TableSink胶台,官網(wǎng)地址
TableSource提供對存儲(chǔ)在外部系統(tǒng)中的數(shù)據(jù)的訪問片林,將外部存儲(chǔ)讀出數(shù)據(jù)并注冊成Table曙旭,并可使用Table和SQL的api。
TableSink向外部存儲(chǔ)系統(tǒng)發(fā)送并保存數(shù)據(jù)麸锉。
TableFactory 隔離用戶使用和代碼實(shí)現(xiàn)
Tips
一精盅、Bahir
官網(wǎng)地址 http://bahir.apache.org/
Apache Bahir為多個(gè)分布式分析平臺(tái)提供擴(kuò)展胳施,通過各種流連接器和SQL數(shù)據(jù)源擴(kuò)展其功能。目前包括
Spark
- Spark data source for Apache CouchDB/Cloudant
- Spark Structured Streaming data source for Akka
- Spark Structured Streaming data source for MQTT
- Spark DStream connector for Apache CouchDB/Cloudant
- Spark DStream connector for Akka
- Spark DStream connector for Google Cloud Pub/Sub
- Spark DStream connector for PubNub
- Spark DStream connector for MQTT (new Sink)
- Spark DStream connector for Twitter
- Spark DStream connector for ZeroMQ (Enhanced Implementation)
Flink
- Flink streaming connector for ActiveMQ
- Flink streaming connector for Akka
- Flink streaming connector for Flume
- Flink streaming connector for InfluxDB
- Flink streaming connector for Kudu
- Flink streaming connector for Redis
- Flink streaming connector for Netty
二羽嫡、Flink其他連接器
Flink除了 kafka本姥、文件系統(tǒng)、es其實(shí)還在源碼中寫了很多連接器杭棵,但都沒有發(fā)布到maven 倉庫中婚惫,如果想引用的話,需要指定apache的服務(wù)器
<repositories>
<repository>
<id>apache.snapshots</id>
<name>Apache Development Snapshot Repository</name>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Example mysql 和 hbase
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-jdbc_2.11</artifactId>
<version>${flink.version}</version>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-hbase_2.11</artifactId>
<version>${flink.version}</version>
</dependency>
Share
《程序員如何技術(shù)變現(xiàn)》
// TODO 這周主題早就想好了,但一直不知道如何寫先舷。
最近有點(diǎn)迷茫艰管,感覺計(jì)算機(jī)這條路走著走著柳暗花明了,但要學(xué)習(xí)的東西越來越多蒋川。最近身邊有很多不錯(cuò)的哥們建議我轉(zhuǎn)行試試牲芋,也提供了就業(yè)機(jī)會(huì)。他們感覺沒有那么多的“術(shù)”但已經(jīng)得了“道”捺球,但什么是道我也說不清缸浦,他們也沒說清,可能就是一種對于成功懶得解釋后的說辭吧懒构。
Research
本周還是繼續(xù)Flink方向餐济,課余時(shí)間研究了一下?lián)屝_本工具。