/images/yun-da.png

卷云

Python basics for algorithm practices

Actively updating… This post assume the reader to be familiar with at least one of other popular used programming language, preferably Java and C++; or know python before and just need refresh. Array Python’s array type is similar to C++’s vector or Java’s ArrayList. And for algorithm practice we usually use list, which will be introduced in next section. Ref: array — Efficient arrays of numeric values # create an array array('u', 'hello \u2641') array('l', [1, 2, 3, 4, 5]) array('d', [1.

Generic recursive lambda in C++14

When we practice LeetCode questions, we always need to write a helper recursive function outside the main solution function. For example, to find the max value in a binary tree, we can have the following codes: (method-1) class Solution { // pre-order DFS void helper(TreeNode *root, int &ret) { if (!root) return; ret = std::max(ret, root->val); helper(root->left); helper(root->right); } public: int findMax(TreeNode *root) { int maxval = std::numeric_limits<int>::min(); helper(root, maxval); return maxval; } }; Sometimes we don’t want to write the helper outside our working function, i.

Differences between an interface and abstract class

Introduction This article is mainly talking about the difference between interface and abstract class, which is a frequently asked questions at interview. I will discuss Java first, and then C++. Personally, I am more familiar with C++, although I can write Java. So at the time one friend asked me about the question, I was shocked. I did not know “interface” at all. But after searching around, I learned that “interface” and “abstract class” are somehow ideas of OOP (especially, Java OOP).

HTTP server inside a docker container

Introduction This article mainly focus on how to run a HTTP server inside a docer container. The key point is port mapping. Basic setup I skipped installation of docker at ubuntu here. Please refer to my last docker note. For server example, I have some in my github. C version Python flask Rust version Here I choose Rust version for example. Run Rust docker # pull rust official image to local docker pull rust # run a container docker run -itd -p 8080:5000 --name httpserver rust Here -itd means ‘interactive’, ‘TTY’ and ‘detached’, which are running options of container.

Bitcoin price prediction

1. Introduction This is a small project to learn basics of TensorFlow and solving time series problems with RNN. For more details, please refer to the codes at Github: ysmiles. 1.1 Time-series A time series is a series of data points indexed (or listed or graphed) in time order. Most commonly, a time series is a sequence taken at successive equally spaced points in time. Thus it is a sequence of discrete-time data.