Re: [algogeeks] Re: Suggest some Data Structure appropriate to the problem

2012-03-07 Thread atul anand
@Karthikeyan : if i have min=2 till now now delete 2 , now what will be min if i call getmin() ??? pointer wont work so we need to use stack to keep track of minimum elements so far. On Wed, Mar 7, 2012 at 5:14 PM, Karthikeyan V.B kartmu...@gmail.com wrote: Hi, Perfect Hashing can be

Re: [algogeeks] Re: Suggest some Data Structure appropriate to the problem

2012-03-06 Thread Sehaj Singh Kalra
@Gene : Thanx for the reply. Understood your point. On Tue, Mar 6, 2012 at 6:24 AM, Gene gene.ress...@gmail.com wrote: What Don so succinctly said is this: Comparison sort _requires_ O(n log n) comparisons. If you had the data structure you're asking for, you could easily implement a

[algogeeks] Re: Suggest some Data Structure appropriate to the problem

2012-03-06 Thread Don
A similar problem which *is* possible is this: How would you implement a stack providing LIFO insert and delete AND the ability to report the minimum value in the stack each in constant time. The solution is to keep a second stack for the minimum values. When an item is inserted, you push it

[algogeeks] Re: Suggest some Data Structure appropriate to the problem

2012-03-05 Thread Don
I want constant time sort, but I can't have that either. Don On Mar 5, 3:27 pm, Sehaj Singh Kalra sehaj...@gmail.com wrote: I want insertion , deletion, find (any general element) and min_element - all 4 operations in constant time order. Is there any data structure that can help me do this?

[algogeeks] Re: Suggest some Data Structure appropriate to the problem

2012-03-05 Thread Gene
What Don so succinctly said is this: Comparison sort _requires_ O(n log n) comparisons. If you had the data structure you're asking for, you could easily implement a comparison sort: Just insert n items, then then repeat n times: find min and delete that min. With your proposed time bounds, the