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

SEARCH KEYWORD -- pre-order



  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

  Name resolution order in JavaScript

To understand what value a variable has in JavaScript, we need to understand some concepts such as scope and name resolution order. JavaScript has two scopes; one is program level and the other one is function level. Unlike in C,C++ or Java, JavaScript has no block level scope. So a variable defined in a if block will still be available outside. For example, the below example: var foo = 1; function bar() { if (true) { var foo = 10; } alert(foo); } bar(); The alert will display 10 since the ...

   JavaScript,Scope,Name resolution     2013-07-10 01:29:28

  How MySQL optmizes ORDER BY

In some situations, MySQL will just use an index to fulfill the requirement of an ORDER BY or GROUP BY statement without extra sorting. Although ORDER BY will not have the exact match with index, index can still be used as long as the portion that is not included in the index is included in the where clause. The following queries will all use index to process the ORDER BY or GROUP BY part: SELECT * FROM t1 ORDER BY key_part1,key_part2,... ;SELECT * FROM t1 WHERE key_part1=constant ORDER BY key_p...

   MySQL,index,ORDER BY,optimization     2012-11-13 11:01:05

  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

  Windows 8 price is unveiled

Although it's still half month away from releases of Windows 8, Microsoft releases price of all versions of Windows 8 on Windowsteam blog. From now on, users can pre-order this product on Amazon, Bestbuy, Staples and Office Depot. The prices for different version : Windows 8 Professional Upgrade : $69.99 Windows 8 Pro Pack-Product Key Card : $69.99 Windows 8 64 bit(Full Version) -- OEM : $99.99 Windows 8 32 bit (Full Version) -- OEM : $99.99 Windows 8 Professional 32 bit (Full Version) -- OEM ...

   Windows 8, Price     2012-10-12 20:03:55

  iPhone 5 first weekend sales over 5 million

Within 24 hours openning for pre-order, 2 million iPhone 5 have been ordered, Apple announces that  sales of iPhone 5 are over 5 million in 3 days on sale., in addition, iOS devices upgraded to iOS6 are around 100 million. Apple CEO Tim Cook says : Demand for iPhone 5 has been incredible and we are working hard to get an iPhone 5 into the hands of every customer who wants one as quickly as possible,While we have sold out of our initial supply, stores continue to receive iPhone 5 shipments ...

   iPhone5,,iOS6,sale,pre-order     2012-09-24 10:55:12

  iPhone 7 may come with following new features

There are all kinds of news that iPhone 7 will be released in the coming September. Now the news seems to be convincing. On 26 August, a Sina Weibo(China's Twitter) user @POPPUR posted an weibo which says that China Telecom, one of the largest telecom vendors in China, has opened the pre-order of iPhone 7. Along with this, a few new features of iPhone 7 are also released. On the photo uploaded, there are a few new features of iPhone 7 displayed. They are : Waterproof No headphone jack Wireless...

   NEW FEATURE,NEWS,IPHONE 7,CHINA TELECOM     2016-08-27 03:50:41

  ConcurrentHashMap vs Collections.synchronizedMap()

ConcurrentHashMap and Collections.synchronizedMap() both provide thread-safe operations of collections of data. They are used in multithreaded programs to provide both thread safety and performance improvements. In many cases, we can use either of them. But the realization of thread safety is different for these two implementations. ConcurrentHashMap will create an HashEntry[] array internally to store the elements passed in from a Map, while Collections.synchronizedMap() will return a Synchroni...

   ConcurrentHashMap,Collections.synchronizedMap     2014-09-18 05:04:59

  Common usage of ls command in Linux

In Linux, ls might be one of the most frequently used commands. It is used to list files in a specific directory. In most cases, we may just use ls -l to list the files under a directory. But have you explored other usages of this command. In this post, we will summarise some other common usages of ls command Assuming we have below directory structure in our system, let's see them using tree command. List details of the files If we want to list the details of the files in /home/alvin/test_...

   LINUX,SHELL,LS     2018-12-16 03:00:42

  Break down defer statements in GoLang

Basic Concepts What are the characteristics of the deferred statement defer in Go language? When is it usually used? The deferred statement(defer statement) in Go language has the following characteristics: Deferred Execution: Deferred statements are executed before the function containing them exits, regardless of whether the function returns normally or encounters an exception. Last In, First Out (LIFO): If there are multiple deferred statements, they are executed in the order of last in, f...

   DEFER,GOLANG     2024-02-10 21:56:10