#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);
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
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
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
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
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
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
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
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
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
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
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
, 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
13 matches
Mail list logo