Algorithm
二叉树根据值删除节点
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,官网地址
TableSource提供对存储在外部系统中的数据的访问,将外部存储读出数据并注册成Table,并可使用Table和SQL的api。
TableSource.pngTableSink向外部存储系统发送并保存数据。
TableSink.pngTableFactory 隔离用户使用和代码实现
TableFactory.pngTips
一、Bahir
Apache Bahir为多个分布式分析平台提供扩展,通过各种流连接器和SQL数据源扩展其功能。目前包括
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、文件系统、es其实还在源码中写了很多连接器,但都没有发布到maven 仓库中,如果想引用的话,需要指定apache的服务器
<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
《程序员如何技术变现》
// TODO 这周主题早就想好了,但一直不知道如何写。
最近有点迷茫,感觉计算机这条路走着走着柳暗花明了,但要学习的东西越来越多。最近身边有很多不错的哥们建议我转行试试,也提供了就业机会。他们感觉没有那么多的“术”但已经得了“道”,但什么是道我也说不清,他们也没说清,可能就是一种对于成功懒得解释后的说辞吧。
Research
本周还是继续Flink方向,课余时间研究了一下抢鞋脚本工具。
网友评论