Morris (InOrder) traversal is a tree traversal algorithm that does not employ the use of recursion or a stack. In this traversal, links are created as successors and nodes are printed using these links. Finally, the changes are reverted back to restore the original tree. Algorithm Initialize current as root While current is not NULL …
How to delete trash files as “~$.doc/xlsx” on Mac
Today I noticed when I typed "ls" in my terminal, some weird files pop up on my terminal. Their format looks like "~$ a.doc" or "~$ b.xlsx". I think their are some remain trash files for which office files that I have deleted or moved away. I tried to delete then using "rm" command but …
Continue reading “How to delete trash files as “~$.doc/xlsx” on Mac”
Two useful tools for your terminal: Ranger and Neofetch
Ranger Ranger could make your directories in your terminal looks more organized and clear, you only need to type ranger Then your terminal would look like: Neofetch Another one is a simple tool to present your device information, you only need to type neofetch Then your terminal would present some information in a pretty way:
Why do we should use intValue() to compare?
The Integer.intValue() is used to get the primitive int value of Integer. The other test cases pass for you because the int values are low and the auto-unboxing feature of java does the value comparison for you. But for this one test case the int values are pretty large and hence it leads to object …
Continue reading “Why do we should use intValue() to compare?”
HashMap computeIfAbsent() method in Java with Examples
The computeIfAbsent(Key, Function) method of HashMap class is used to compute value for a given key using the given mapping function, if key is not already associated with a value (or is mapped to null) and enter that computed value in Hashmap else null. If mapping function of this method returns null, then no mapping …
Continue reading “HashMap computeIfAbsent() method in Java with Examples”
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 …
Continue reading “Application Layer – Reading Notes on Computer Networking A Top-Down Approach Ch.2”
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 …
Continue reading “How to avoid Integer Overflow when comparing two node valued in BST?”
Can’t Find Added Images In Android Studio Drawable Folder?
I have moved pictures to drawable folder: But when I tried to use one of the as the background picture, I can’t find some of them: The reason is: Please Note the image name can only include lowercase a-z, 0-9, or underscore, otherwise there will have an error when you rebuild the android project. The …
Continue reading “Can’t Find Added Images In Android Studio Drawable Folder?”