Edit Distance

The edit distance algorithm is very popular among the data scientists. It’s one of the basic algorithms used for evaluation of machine translation and speech recognition. The naive approach would be to check for all possible edit sequences and choose the shortest one in-between. That would result in an exponential complexity and it’s an overkill …

Application Layer – Reading Notes on Computer Networking A Top-Down Approach Ch.2

Principle of Network Application Application Architecture Client-Server Architecture Data Center, housing a large number of hosts Google, Amazon, etc. P2P Architecture Peers. Application exploits direct communication between pairs of intermittently connected hosts. Traffic-intensive applications: BitTorrent, XunLei, etc. Processing Communicating Processes communicate among different end-system hosts Processes on two different end systems communicate with each other …

Long VS Integer

Long is the Object form of long, and Integer is the object form of int. Integer is a signed 32 bit integer type Denoted as Int Size = 32 bits (4byte) Can hold integers of range -2,147,483,648 to 2,147,483,647 default value is 0 Long is a signed 64 bit integer type Denoted as Long Size …

How to avoid Integer Overflow when comparing two node valued in BST?

For example, if here are one BST as: [Integer.MIN_VALUE, Integer.MIN_VALUE] If I want to compare if the left child node is smaller or equal to parent nod – 1, the value gonna be overflow. In this case, don’t use Integer.MIN_VALUE, use null as the default instead. Here is an example about using null as comparison …