Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- Binary tree



  Algorithm: Traverse binary tree

Preface There are three ways to traverse a binary tree based on the traversing order. Pre-Order: Root - Left - Right In-Order: Left - Root - Right Post-Order: Left - Right - Root Take below binary tree as example The node to be traversed in different order would be Pre-Order: A - B - C - D - E - F In-Order: C - B - D - A - E - F Post-Order: C - D - B - F - E - A Below are the implementations of different orders for traversing the binary tree. Pre-Order Traversing Recursive implementation N...

   ALGORITHM,BINARY TREE     2019-03-01 22:49:04

  Binary tree iterator algorithm

Binary tree pre-order,in-order and post-order traversal are basics in algorithm and data structure.And the recursive binary tree traversal is a classical application of recursion. We define a binary tree node as : // C++ struct Node { int value; Node *left; Node *right; } In order binary tree traversal can be: // C++ void inorder_traverse(Node *node) { if (NULL != node->left) { inorder_traverse(node->left); } do_something(node); if (NULL != node->righ...

   Binary tree,Iterator,Traversal     2013-07-14 21:51:09

  Converting Decimal Fractions to Binary

Converting Decimal Fractions to Binary In the text proper, we saw how to convert the decimal number 14.75 to a binary representation. In this instance, we \"eyeballed\" the fractional part of the binary expansion; 3/4 is obviously 1/2 + 1/4. While this worked for this particular example, we\'ll need a more systematic approach for less obvious cases. In fact, there is a simple, step-by-step method for computing the binary expansion on the right-hand side of the point. We will illustrate the metho...

   Decimal,Fractional,Binary     2011-03-19 06:45:35

  Unix directory hierarchy history

As a beginner user of Unix or Linux, people would frequently get confused about the use of different directories of the system.  For example, there is a /bin directory under root(/), it is used to store binary files. However, there are /usr/bin and /usr/local/bin under /usr which are used for storing binary files as well. Some systems even have /opt/bin. What are the differences among them? Though there are articles explaining different directories in *nix such as Filesystem Hierarchy Stan...

   UNIX,LINUX,FILESSYTEM,DIRECTORY HIERARCHY,HISTORY     2016-10-21 23:47:17

  About go get and go install in Go 1.16

Go version 1.16 beta1 has been released on 18 Dec 2020, major features of Go 1.16 have been finalized with this beta release. Many people are discussing about the support of Apple M1, however, this post will not cover this topic. Instead the focus will be on go get and go install changes. There are lots of changes related to modules in Go 1.16, the details can be found in the release note. Below are some of the key highlights. GO111MODULE is on by default, if wanna keep old behavior, needs...

   GOLANG,GO 1.16,GO INSTALL     2020-12-26 00:26:58

  Some geek mats to welcome guests

Geeks are mostly otaku, they like surfing the Internet, playing games. Perhaps not everyone is a programmer, but most of them have some understanding of programming. It is undoubtedly very necessary to have a specific pattern mat at the door as a glorious proud geek, what mat should you use? 1. Binary Floor/Door Mat There are 10 kinds of people in the world, one is understanding binary code, the other one who doesn't understand binary code. The above binary mat is the binary codes of " welcome"...

   Mat,Geek,Entertainment     2012-10-05 19:39:24

  JavaScript Is Not A Language

Recently people presented arguments for and against using CoffeeScript. I felt the argument against was pointless and obviously wrong, but I couldn't figure out why, and I thought the counterargument for was kind of toothless and irrelevant. I've figured out the real issue.The real argument for CoffeeScript is that JavaScript is not really a language.Years ago I read something which explained, in my opinion, why Lisp has never achieved the mainstream adoption its passionate advocates belie...

   JavaScript,Not a language,CoffeeScript,Model     2011-12-29 08:46:15

  Javascript motion tracking

It is very often that I have to do video motion tracking for interactive video campaign in my daily work. If I’m used used to do that in Flash, I made a quick experiment to do the same in javascript. Thanks to Olof Storm who made me a perfect corner pin motion tracking in After Effects, and I’ve been using some code from Steven Wittens to draw an image in perspective. Click here to see the motion tracking demo (give it a bit of time to fully load). What I’m doing in this dem...

   JavaScript,Motion tracking,Flash     2012-03-20 07:43:46

  Install multiple versions of Go

As a developer, there might be need in some cases to have multiple versions of Go installed. One may test out some new features of the latest version of Go but also wanna maintain a stable version of Go for daily development purpose. How to maintain multiple versions of Go? The GoLang official website has provided a way to maintain multiple versions of Go by using go get to install the different versions of Go. Below are steps: Download a normal version of Go and install it Go to the Go release...

   MULTIPLE VERSION,GO BINARY,GO VERSION     2021-05-16 02:01:46

  GoLang to build smaller executable file

Normally the executable file built with go is a bit large, it is always desired that a smaller executable file should be generated though. In this post, a couple of ways to reduce the size of the executable will be introduced. The end effect is that the executable file size would be much less than the normal generated one. The file which is built normally has below size. Mode LastWriteTime Length Name ---- ------------- ------ ---- -a---- 12/14...

   GOLANG,EXECUTABLE     2019-12-13 20:10:45