
D&A
文章平均质量分 80
williamcs
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Sudoku backtracking with one dimension array
package hello.test;import java.io.*;import java.util.*;public class Sudoku { private static final int N = 9; // the size of the board private int[] board; // the one dimension array原创 2012-11-27 14:47:00 · 801 阅读 · 0 评论 -
Merge Sort and apply it to an interview question
Merge Sort is very efficient in sorting a list of elements with O(nlgn) complexity. It is used with divide and conquer strategy.A few days ago, I came to an interview question, the description o原创 2013-08-17 10:38:48 · 923 阅读 · 0 评论 -
k Means clustering c++ implementation
KMeans is very common unsupervised learning algorithms, below is the algorithm.c++ implementation:#include #include #include #include #include using namespace std;// get the all the li原创 2014-01-03 18:25:02 · 1591 阅读 · 0 评论 -
Lowest common ancestor in binary search tree
This is a very common question原创 2014-09-01 16:20:40 · 530 阅读 · 0 评论 -
Logical Indexing in matlab
As you know, vectorized programming has many advantage places. It's neat, effienct, sometimes it is very short and much easier than writing long tedious loops code. When manipulate matrix or data, i原创 2015-05-08 11:05:24 · 1715 阅读 · 0 评论 -
Select Sort in scala
Below I written a simple select sort in scala, just for record something.object SelectSort { /* Return the index of the minimum element in the given array, index range [left, right]原创 2015-08-17 18:57:41 · 594 阅读 · 0 评论 -
PageRank Spark implementation
As you know, PageRank is very famous algorithm. For the detail of pagerank defination and implemenation, you can refer tohttps://en.wikipedia.org/wiki/PageRank There are many implementa原创 2015-09-07 18:51:01 · 1031 阅读 · 0 评论 -
Peak Finding
1D Peak FindingObjectiveGiven an array A with n elements, find the index i of the peak element A[i] where A[i] >= A[i - 1]and A[i] >= A[i + 1]. For elements on the boundaries of the array, the原创 2015-09-15 18:12:24 · 1897 阅读 · 0 评论 -
Document distance note
Document DistanceDocument = sequence of words-Ignore punctuation & formattingWord = sequence of alphanumeric charactersHow to define "distance"?Idea: focus on shared wordsWord原创 2015-09-15 18:17:43 · 911 阅读 · 0 评论 -
Implement a spell checker with java
When you typing a word, many systems will suggest many words for you to select the word which you intend to type. This is spell checker.It will calculate the edit distance between a dictionary. Ever原创 2013-05-04 16:54:07 · 892 阅读 · 0 评论 -
Longest common subsequence problem and poj 1159 Palindrome
The longest common subsequence problem is a very basic problem in dynamic programming. If you dive in,there is manyothermethods to compute thelongest common subsequence. Hereis just the very basic原创 2013-04-24 12:40:18 · 802 阅读 · 0 评论 -
QuickSort two way, three way partition and many other implementations
Quicksort is so famous which was honored as one of the top 10 algorithms of 20th century in science and engineer. It is use thedivide and conquer strategy. Divde the array into two subarray and recu原创 2013-01-08 15:19:26 · 3631 阅读 · 0 评论 -
Incomplete checkerboard covering
Cover a checkerboard that has one corner square missing. The size of the board is usuall 2**k, use recursive way the board will bedivided into four 2**(k-1) size small board. Cover the center board原创 2012-11-28 15:07:35 · 683 阅读 · 0 评论 -
Dynamic Array Implementation in Java
package test.dynamic.array; import java.util.*; public class DynamicArray { private static final int INIT_SIZE = 1; private T[] array; // the internal array private int size = 0原创 2012-11-15 11:03:40 · 863 阅读 · 0 评论 -
Simple base conversion implementation use java
The stack interface defination:package test.baseconversion;public interface IStack { public abstract void push(T value); public abstract T pop(); public abstract T top(); public原创 2012-11-15 11:00:02 · 444 阅读 · 0 评论 -
Disjoint set and poj 1611
package hello.test;import java.io.File;import java.io.FileNotFoundException;import java.util.Scanner;public class DisjointSet { private final static int DEFAULT_SIZE = 10; private in原创 2012-11-30 17:20:56 · 717 阅读 · 0 评论 -
Quick sort and the Kth number
import random# partition list L use the rightest element as pivot def partition(L, left, right): x = L[right] i = left - 1 for j in range(left, right): if L[j] < x:原创 2012-11-22 15:02:00 · 590 阅读 · 0 评论 -
Simple T9 implementation with Trie
package hello.test;import java.io.*;import java.util.LinkedList;import java.util.Queue;public class Trie { private final int R = 26; // the trie branches private Node root = new N原创 2012-12-07 11:03:53 · 3190 阅读 · 1 评论 -
Levenshtein's eidit distance
From Wiki, the definition of Levenshtein distance is astring metric for measuring the difference between two sequences. Informally, the Levenshtein distance between two words is equal to the numb原创 2012-11-24 12:06:16 · 579 阅读 · 0 评论 -
Missionaries and Cannibals problem breadth first search implementation
Problem description: Three missionaries and cannibals want to cross the river using a boat which can carry at most two people, under the constraint that, for both banks, if there are missionries p原创 2012-12-15 13:56:43 · 4510 阅读 · 0 评论 -
Find the kth largest element in an unsorted array
This is should be an old problem, I had written some code long time ago. This time I just write some code for review. The idea is the same as quick sort. There are many other methods too, but this met原创 2016-03-11 22:30:00 · 732 阅读 · 0 评论