Re: [algogeeks] Hash Table ( A hashtable class in c++)

2011-09-02 Thread Aj G
#includecstdio #includemap #includevector #includecstdlib using namespace std; // It is not advisable to list all elements in this hash table. #define HASH_SIZE 51439 class HashTable { public: vector maplong long,int table; HashTable() { table = vector maplong long,int (HASH_SIZE);

[algogeeks] Re: remove duplicate words in a string

2011-08-05 Thread aj
you can write a python program to do that easily. program starts here : c=str.split(raw_input()) d=[] for x in c: d[x]=0 print list(d) -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to

[algogeeks] Re: Finding the distance between two permutations of a string of length N

2006-05-15 Thread aj
of correctness is by induction on number of cycles. thx aj --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group

[algogeeks] Re: Median of 2 combined array X[1...n] and Y[1...n] sorted in 0(lgn)

2006-05-12 Thread aj
How about finding the median of (X + Y) in subquadratic time. X + Y = {z | z = xi + yj for some i and j}. I could only reduce the space complexity from O(n^2) to O(n) but time complexity still remains O(n^2). thx Aj --~--~-~--~~~---~--~~ You received

[algogeeks] Re: Median of 2 combined array X[1...n] and Y[1...n] sorted in 0(lgn)

2006-05-12 Thread aj
well the set (X + Y) will have O(n^2) elements, where X and Y have n elements. As an example X = {1, 2} Y = {3, 5} X + Y = {1 + 3, 1 + 5, 2 + 3, 2 + 5} = {4, 5, 6, 7} Now the problem is to find the median of X + Y in subquadratic time. thx aj

[algogeeks] Re: A problem related to palindromes

2006-05-02 Thread aj
hi daizi, I was expecting a solution that does not use suffix trees. Using suffix trees the problem can be solved easily, but I was just wondering if it is mandatory to use complex data structures like suffix trees to solve this problem. thx aj

[algogeeks] Re: A problem related to palindromes

2006-05-02 Thread aj
linear worst case time. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL

[algogeeks] A problem related to palindromes

2006-05-01 Thread aj
Given a binary string x of length n, find the longest prefix of x in linear time which is a palindrome. thx aj --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send

[algogeeks] Re: How to find, efficiently, the maximum sum of atleast L consecutive integers from a sequence of N integers.

2006-03-21 Thread aj
of the subsequence) then your solution is excellent with O(n) time and O(1) space complexity. thx Aj --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks

[algogeeks] Re: How to find, efficiently, the maximum sum of atleast L consecutive integers from a sequence of N integers.

2006-03-20 Thread aj
it helps Aj --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more

[algogeeks] Re: determine whether a matrix is rearrangeable

2006-03-19 Thread aj
SPX2 wrote: what complexity aj ? O(ne) where e is the n is the number of rows and e is the number of 1's in the matrix. worst case O(n^3). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group

[algogeeks] Re: determine whether a matrix is rearrangeable

2006-03-19 Thread aj
the matrix 1 1 1 1 1 1 1 1 1 has rank 1, but is still rearrangable, so it seems linear dependence has not much to do with the problem. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

[algogeeks] scheduling problem

2006-03-17 Thread aj
, or this small modification moves the problem from the class P to the class of NP-complete. thanks in advance Aj --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send