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