![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
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 · 765 阅读 · 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 · 879 阅读 · 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 · 1535 阅读 · 0 评论 -
Lowest common ancestor in binary search tree
This is a very common question原创 2014-09-01 16:20:40 · 498 阅读 · 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 · 1623 阅读 · 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 · 557 阅读 · 0 评论 -
PageRank Spark implementation
As you know, PageRank is very famous algorithm. For the detail of pagerank defination and implemenation, you can refer to https://en.wikipedia.org/wiki/PageRank There are many implementa原创 2015-09-07 18:51:01 · 988 阅读 · 0 评论 -
Peak Finding
1D Peak Finding Objective Given 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 · 1839 阅读 · 0 评论 -
Document distance note
Document Distance Document = sequence of words -Ignore punctuation & formatting Word = sequence of alphanumeric characters How to define "distance"? Idea: focus on shared words Word原创 2015-09-15 18:17:43 · 865 阅读 · 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 · 851 阅读 · 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 · 769 阅读 · 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 the divide and conquer strategy. Divde the array into two subarray and recu原创 2013-01-08 15:19:26 · 3562 阅读 · 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 be divided into four 2**(k-1) size small board. Cover the center board原创 2012-11-28 15:07:35 · 644 阅读 · 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 · 778 阅读 · 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 · 412 阅读 · 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 · 685 阅读 · 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 · 555 阅读 · 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 · 3126 阅读 · 1 评论 -
Levenshtein's eidit distance
From Wiki, the definition of Levenshtein distance is a string 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 · 539 阅读 · 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 · 4417 阅读 · 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 · 697 阅读 · 0 评论