Monthly Archives: August 2012

counting sort

#include <stdio.h>#include <string.h> #define BOUNDARY 7 /** * inputArr – pointer to input array * outputArr – pointer to output array * length – lenght of input array **/int *countingSort( int *inputArr, int *outputArr, int length ); int main( void … Continue reading

Posted in Uncategorized | Leave a comment

LeetCode: Anagrams – – 博客频道 – CSDN.NET

http://blog.csdn.net/wyc1230/article/details/7377621

Posted in Uncategorized | Leave a comment

Test

Test

Posted in Uncategorized | Leave a comment

add 2 linklist

3->1->5  +    5->9->2 , you get 8->0->8   3->1->5 + 5->9->4 you get 8->0->0->1 #include<stdlib.h>#include<stdio.h> typedef struct node{    int data;    struct node *next;}*Linklist; Linklist initLinklist( ); Linklist insert( Linklist l, int num ); Linklist add( Linklist l1, Linklist l2 ); … Continue reading

Posted in Uncategorized | Leave a comment

Binary search tree

BSTree.h #include <deque>    using namespace std; #ifndef BSTREE_H_INCLUDED#define BSTREE_H_INCLUDED typedef int ElementType;struct TreeNode; /*struct TreeNode{    ElementType Element;    struct TreeNode* Left;    struct TreeNode* Right;} ;*/ typedef struct TreeNode *Position;typedef struct TreeNode *SearchTree; // re-use the TreeNode to create a doulbe … Continue reading

Posted in interview | Tagged | Leave a comment

nterview: Remove Loop in linked list – Java

  http://stackoverflow.com/questions/5607292/interview-remove-loop-in-linked-list-java I was asked this question in interview: “How to detect the loop in linked list?”, I solved this but immediately the interviewer asked me how do I remove the loop in a linked list. I fumbled. So any … Continue reading

Posted in Uncategorized | Leave a comment

remove duplicates

package interviewPractice; import java.util.Hashtable;import java.util.Iterator;import java.util.LinkedList; public class RemoveDupsFromLinklist {     // using tempory buffer    public static void deleteDups(LinkedList<String> linkedList) {        if (linkedList == null) {            return;        }        if (linkedList.size() == 1) {            return;        }        Iterator<String> it = linkedList.iterator();        Hashtable<String, … Continue reading

Posted in Uncategorized | Leave a comment

java collections

http://www.java2s.com/Code/Java/Collections-Data-Structure/CatalogCollections-Data-Structure.htm   http://www.java2s.com/Code/Java/Design-Pattern/CatalogDesign-Pattern.htm   http://www.java2s.com/Code/Java/Threads/CatalogThreads.htm

Posted in Uncategorized | Leave a comment

HTTP Programming Recipes for Java Bots

680 pages Publisher: Heaton Research, Inc. (April 17, 2007) Language: English ISBN-10: 0977320669 ISBN-13: 978-0977320660 The Hypertext Transfer Protocol (HTTP) allows information to be exchanged between a web server and a web browser. Java allows you to program HTTP directly. … Continue reading

Posted in Uncategorized | Leave a comment

how to get matrix row and column

  package algorithm.codingpractice; public class Matrixlength{     /**     * @param args     */    public static void main( String[] args )    {        // TODO Auto-generated method stub        int[][] matrix = new int[3][4];        System.out.println( matrix.length );        System.out.println( matrix[0].length );        int[][][] matrix1 = new … Continue reading

Posted in Uncategorized | Leave a comment