[algogeeks] Re: Cards collection problem

2009-02-23 Thread Luciano Pinheiro
Ok, Mr. Balaz. 2009/2/23 Miroslav Balaz : > Yes but you mus be careful with c+r. > p > you should use c*X+r, where X is large enough number. > If you X is 2 to 16,(16th power of two), the you get the same as using first > two bytes for collection and second for number, > but you can use. ==> Yes,

[algogeeks] Re: Cards collection problem

2009-02-23 Thread Miroslav Balaz
Yes but you mus be careful with c+r. p you should use c*X+r, where X is large enough number. If you X is 2 to 16,(16th power of two), the you get the same as using first two bytes for collection and second for number, but you can use. The radix sort is good idea. But i suppose not to keep data se

[algogeeks] Re: Cards collection problem

2009-02-22 Thread Luciano Pinheiro
Hello again Mr. Balaz, I`m writting to thank You very, very so much about yours information, that give "the path of stones" to solution my problem. I think very well in this weekend and I came to this conclusion: All collections have a number maximum limit MAX (C), where MAX (C) ≤ 2000 for each

[algogeeks] Re: Cards collection problem

2009-02-20 Thread Miroslav Balaz
I thing you the only choice, is binary search tree, but it is the most obvious one. It imposible to make it independent form cards universe,as far as i know but it can be made int time O(log(nmU)),where U is number of cards, it is much less than O(n). But you must think about what is the problem, i

[algogeeks] Re: Cards collection problem

2009-02-20 Thread Luciano Pinheiro
Very thanks Mr. Balaz. The really situation is : I must to make a program that manage this "exchange cards problem" and I did not have any idea how to attack this problem. I need to know how put the card's numbers into a structure that a search to a desired/recurring item at least run in time no

[algogeeks] Re: Cards collection problem

2009-02-18 Thread Miroslav Balaz
This is not algorithm problem, it is homework problem do it yourself. I see there one problem, and it is how large is N I suggest you to represent sets as pairs(cardID,repeat number ) that means for each card you remember number of how much you have of that card, and when there is zero, it means