LeetCode- Add and Search Word - Data structure design Solution

leetcode 211 Trie的添加及搜索

2021-01-27 · 5 min · 1015 words · Garlic Space

python map & filter & reduce

map, filter, reduce 是函数式编程的函数, 不再需要循环分支使得代码更加简洁。map/reduce 和google的map/reduce功能是类似的, filter有些类似shuffle, 当然shuffle更多的工作是将相同的key放到同一个reduce计算中 map 1 map(function_to_apply, list_of_inputs) 例如: 1 2 3 4 5 items = [1,2,3,4,5] squared = [] for i in items: squared.append(i**2) print(squared) <=> 等价于 1 2 3 items = [1,2,3,4,5] squared = list(map(lambda x: x**2, items)) print(squared) filter 1 filter(function_to_apply, list_of_inputs) 接着上面的代码继续 1 2 3 4 5 less_than_ten=[] for i in squared: if i < 10: less_than_ten.append(i) print(less_than_ten) <=> 等价于 1 2 3 less_than_ten=[] less_than_ten = list(filter(lambda x: x<10, squared)) print(less_than_ten) reduce 1 reduce(function_to_apply, list_of_inputs) 和上面两个函数不同, reduce将进行迭代合并操作 1 2 3 4 product = 0 for i in less_than_ten: product = product + i print(product) <=> 等价于 ...

2021-01-17 · 1 min · 129 words · Garlic Space

可逆计算 reversible computing

本周在学习Trie数据结构的时候,看到了他的发明者 Edward Fredkin,他也在研究reversible computing 弗雷德金(Fredkin)对计算,硬件和软件一直很感兴趣。 在1960年代初期,他在BBN编写了第一台PDP-1汇编程序。 他是trie数据结构,Fredkin gate和Billiard-Ball计算机模型的可逆计算的发明者。 他的主要贡献包括他在可逆计算和元胞自动机方面的工作。 他还研究领域还包括计算机视觉,人工智能研究和计算机象棋。 ...

2021-01-17 · 1 min · 70 words · Garlic Space

关于Trie

最早提及Trie树的一篇文章

2021-01-16 · 17 min · 3602 words · Garlic Space

LeetCode- Replace Words Solution

题目: In English, we have a concept called root, which can be followed by some other word to form another longer word - let’s call this word successor. For example, when the root "an" is followed by the successor word "other", we can form a new word "another". Given a dictionary consisting of many roots and a sentence consisting of words separated by spaces, replace all the successors in the sentence with the root forming it. If a successor can be replaced by more than one root, replace it with the root that has the shortest length. ...

2021-01-12 · 4 min · 800 words · Garlic Space

docker安装 zookeeper, dubbo-admin

1 . 环境:

2020-12-23 · 1 min · 85 words · Garlic Space

docker安装tomcat

1 . 环境:

2020-12-22 · 1 min · 112 words · Garlic Space

cenos7 docker安装

环境:

2020-12-21 · 1 min · 64 words · Garlic Space

spring boot+maven 生成多模块项目

spring boot + maven配置, 创建一个包含多个模块项目的步骤 项目创建 使用spring的initializr 选择一下就可以生成代码 项目: tongda (jar) 模块: user (war) order (war) common (jar) 配置: Project : Maven Project Language : Java Spring Boot : 2.4.1 Dependencies: Java : 11 Packaging :jar/war 调整 parent POM 修改tongda的pom.xml, 打包类型设置为pom 新增packaging 标签并设置为pom 1 <packaging>pom</packaging> 通知增加模块配置 1 2 3 4 5 <modules> <module>user</module> <module>order</module> <module>common</module> </modules> 各个模块中调整parent标签 order, user模块 pom.xml文件 1 2 3 4 5 6 <parent> <groupId>com.tongda</groupId> <artifactId>tongda</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> 验证 1 2 3 4 5 6 7 8 9 10 11 12 > mvn clean package ... [INFO] Reactor Summary: [INFO] [INFO] tongda 0.0.1-SNAPSHOT .............................. SUCCESS [ 1.250 s] [INFO] user ............................................... SUCCESS [ 9.161 s] [INFO] order .............................................. SUCCESS [ 6.106 s] [INFO] common 0.0.1-SNAPSHOT .............................. SUCCESS [ 4.226 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ ... 参考引用 https://www.baeldung.com/maven-multi-module https://github.com/bz51/SpringBoot-Dubbo-Docker-Jenkins Photo by Zaksheuskaya from Pexels

2020-12-21 · 1 min · 140 words · Garlic Space

用Spring boot 生成Java项目

学习java, 尝试用了spring boot创建了一个项目, 使用是maven配置, spring boot 提供很多的模板, 创建项目非常方便, 这让我想起了visual studio 点击几下鼠标自动生成模板代码。

2020-12-16 · 3 min · 509 words · Garlic Space