Java

Sudoku Solver in Java

SudokuSolver

This is a Sudoku solver that uses arc consistency and domain splitting. Also able to tell if a board has no or many solutions.

Download SudokuSolver

Deterministic Linear Time k-Select Algorithm

Code

This is an implementation of linear time selection by Blum, Floyd, Pratt, Rivest, and Tarjon in Java.

Pseudocode:

BSelect(A,k):
    If |A| == 1 return A[1]
    p = GoodPivot(A)
    S = { A[i] | A[i] < p }
    L = { A[i] | A[i] > p }
    If |S| >= k return BSelect(S,k)
    else if |S| == k-1 return p
    else return BSelect(L, k-|S|-1)

GoodPivot(A):
    Divide A into n/5 groups of 5 elements each
    Find the median of each group
    Use BSelect to find the median, p, of the n/5 medians
    Return p

View implementation


From Java to C++: Similarities and Differences

After some fiddling with XCode and C++, I finally got it compiling my Hello World. To my pleasure, the syntax in C++ is somewhat similar with Java, but there are still many differences.

Read the rest of this entry »

Quizzicle: A Java Math Quiz Generator

quizzicle

Here is a quick Java application I whipped up. Quizzicle is a command line application that generates random math equations. You can choose an arithmetic operation, the number of questions, the number of digits in the question, and if negative numbers or zeros are allowed. Javadoc included.

quizzicle-optionsUpdate 1.1:

  • Adds a Timer
  • Adds Logging (writing to a file)
  • Various other minor features

I did not plan to release this one so you may see a few hacks.

Download Quizzicle 1.1

Installing the Eclipse IDE

eclipse-ganymede

This guide will show beginner programmers how to set up and install JDK and the Eclipse IDE. I will be installing JDK 6 Update 7 and Eclipse 3.4.0 Ganymede.

Read the rest of this entry »