Blog Lists

Blog

Binary search – locate target fast in O(logn)

Binary search is an efficient algorithm for finding an item from a sorted list of items. Here you will find several morphs with the source code.

Read More

Remove Duplicates from sorted LinkedList

Give a list of sorted numbers, delete all duplicates such that each element appear only once. Time complexity must be in O(n).

Read More

Multiply Strings – Leetcode Medium

Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.

Read More

Travel Blog – PHP

This project was developed while I taught the course Web and Database programming. The students work on the projects step by step, and eventually make it dynamically.

Read More

SaskRCE Website

Drupal is an open source platform for building amazing digital experiences, which SaskRCE Website is built on.

Read More

Java Reflection makes it possible to inspect

Reflection is an API which is used to examine or modify the behavior of methods, classes, interfaces at runtime. A class has multiple component…

Read More

Bucket Sort, Bubble Sort, Selection Sort, and Quick Sort

Sorting is really important in software development. This article brings the four sort algorithms, which are Bucket Sort, Bubble sort, selection sort and quick sort.

Read More

Employee Portal

SGI Employee Portal, which is the most complex website that I built on the platform. It contains the news social features, sending internal messages, pushing notifications, etc.

Read More

SGI

Saskatchewan driver’s licensing and vehicle registration website. It has 10,000 + visitors per day, which is a relative high-traffic website.

Read More

SaskShare AI Platform

How often do we utilize our productive capital, productive capital being the equipment that we purchase for daily activities as individuals, businesses, governments, or universities?

Read More

SGI CANADA

This is the first project that I have been working on after I graduated from the University.

Read More

Measure execution time for a method

The duration of running the method is the execution time [Figure below]. In Java, there are plenty of methods to measure the execution time.

Read More

Topological Sort

Read More

Tree Traversal code implementation in Recursive and Iterative Ways

1. Description Recursive way is based on computer program, the function calling stack. While iterative way is programmer use stack to simulate it. 2. Solution

Read More

LRU Cache – LeetCode 146

1. Description Design and Implement a data structure for LRU cache. It should support get and put. get(key) – Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.put(key, value) – Set or insert the value if the key is not already present. When the cache reached […]

Read More

Base 7

1. Description Given an integer, return its base 7 string representation. 2. Example 3. Solution 4. Complexity Time: O(n) Space: O(1)

Read More

Find the sum of the two elements of a given array which is equal to an given integer

1. Description Asked by Google. Given a list of numbers and a number k, return whether any two numbers from the list add up to k. 2. Example Given [10, 15, 3, 7] and k of 17, return true, since 10+7 is 17. 3. Solution – 3 ways to solve it.

Read More

Shortest Unsorted Continuous Subarray

1. Description Given an integer array, you need to find one¬†continuous subarray¬†that if you only sort this subarray in ascending order, then the whole array will be sorted in ascending order, too. You need to find the shortest such subarray and output its length. Example 1: Input: [2, 6, 4, 8, 10, 9, 15] Output: 5 Explanation: […]

Read More

Use Struts2 + Hibernate Implement CRM Application

Apache Struts is a free, open-source, MVC framework for creating elegant, modern Java Web applications. This post introduces an app implement by Struts + Hibernate.

Read More

Best time to buy and sell stock – one time transaction

1. Description Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (i.e., buy one and sell one share of the stock), design an algorithm to find the maximum profit. Note that you cannot sell a stock […]

Read More

Word Pattern

1. Description Give a pattern and a string, and check if the string follows the pattern. 2. Example 3. Solution 3.1 Wrong solution First, I was thinking, if I can use the AscII code to represent the pattern. For example: hello -> ‘a’, and hello -> ‘a’, world -> ‘b’, world->’b’. Use the data structure […]

Read More

Google Initial Phone Screen with Recruiter

1. Questions What’s the best/worst running time of Merge Sort? O(nlogn), O(nlogn) What’s the best/worst running time of Quick Sort? O(n), O(n^2) What’s the worst running time for a look up in a HashTable? O(n) two reasons: if too many elements were hashed into the same key: looking inside this key may take O(n) time; […]

Read More