[My favorite series] Circus Ponies Notebook

I have been using Mac for one year, I am very satisfied with the performance and appearance Mac gave me. Because I believe in 『efficiency stands on good tools』, I am always looking for wonderful tools for some specific purposes. So, today is the premiere of My favorite series posts by starting from introducing the Notebook software developed by Circus Ponies

This software is the most elegant, beautiful, intuitive and useful notebook software I’ve ever tried. After I downloaded the trial version for several hours, I purchased an academic license. The following introduction starts from a briefing of interface, some issues I found and how I use it so far.

Read the rest of this entry »

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

How to find all the subsets of a given List(or Collection): Part 1

Today I am going to share the algorithm of how to generate all the subsets from a given Collection. For example, if the given collection is an int array [1,2,3], then its subsets are [[1], [2],[3],[1,2],[1,3],[2,3],[1,2,3]]. First of all, let’s look at the first few examples.

Source Subsets
[1] [1]
[1,2] [1],[2],[1,2]
[1,2,3] [1], [2],[3],[1,2],[1,3],[2,3],[1,2,3]

Read the rest of this entry »

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Search an ascending String array interspersed with empty Strings

The problem is stated as:

Given a String array arr, where all the strings in it is pre-sorted in ascending order, however, there are indefinite number of empty strings in it as well. For example,

arr={"", "", "", "36b", "ich099tb", "yi", "zrdy46", "", "", "", ""}

We can tackle this problem by using a modified binary search, and I came up with one recursion solution as well as an iterative one. The code is again simple. I first provide the test code, the implementation follows.

Read the rest of this entry »

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

LOCSale.com: Website for Moving Sale

LOCSale.com

was developed in an effort of assisting people who are having a moving sale and those who are going to move to a new place and need some stuff from moving sale. I have been working on this website and that’s why my blog is not updating for a while. This post is to demonstrate the usage of the website, and a thorough starter guide. Although the interface of LOCSale.com is pretty straightforward, there could be some minor confusion because this website has two account system simultaneously.

The following article falls into several parts: Introduction, Registration Routine, Login Routine, and User Management.

Read the rest of this entry »

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Find common numbers in arrays: Part 3

Reminder: out problems are

  1. How to find the first common integer in two pre-sorted array
  2. How to find the first common integer in two unsorted array
  3. How to find all the common numbers in two pre-sorted array
  4. How to find all the common numbers in two unsorted array
  5. How to find all the common numbers in three pre-sorted array
  6. How to find all the common numbers in three unsorted array
  7. Finally, here is the problem that this series of posts are gonna discuss: How to find all the common numbers in n unsorted arrays

Speaking of the 2nd, 4th and 6th problem, we can either achieve O(n lg n) running time by sorting the array first then perform the operations discussed in previous posts, or we can take advantage of a Set to determine whether the element has presented or not and achieve linear running time with linear space complexity.

Now, here is the generalized solution for the 7th problem: How to find all the common elements in n unsorted arrays. Basically, the logic for the program is to maintain an array pool which was implemented as a HashMap mapping from the array to an Integer which will be used as its pointer. You can add an array into the object, or you can specify a List of arrays. While adding an array to the pool, the program will first check if the array has been sorted in ascending order, if not, using a quick sort to sort it then add it to the pool. At any time, you can use getCommonElements() function which returns an ascending array of common elements among all the arrays in the pool.

Read the rest of this entry »

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...