Re: [ counting sort ideea... ]
- From: "Marcin" <zgadnij@xxxxxxxxx>
- Date: Mon, 21 Nov 2005 19:18:10 +0100
"ed.thyme" :
> have a data structure and also i have 3 basic operation, find_min,
> delete_min and insert .
> A sequence of m operation could look like this:
> insert,insert,insert,delete,find_min....etc..
> Any M operations of these, should have O(M+k) complexity( O(m+k) -worst
>
> case).
> My ideea is to have a sorted array, so the minimum would be on the
> first position so the complexity would be O(1) for find_min and delete.
>
> But i don't know what to do with insert . Any clues ?
what is k ? constant ? so O(n+k)=O(n)?
if
n x (insert) is O(n), and
n x (find_min,delete_min) is O(2n)
then u can sort your data in O(3n) time... so i it's not possible (in
general case)
greets
Marcin
.
- Follow-Ups:
- Re: [ counting sort ideea... ]
- From: ed.thyme
- Re: [ counting sort ideea... ]
- References:
- [ counting sort ideea... ]
- From: ed.thyme
- [ counting sort ideea... ]
- Prev by Date: [ counting sort ideea... ]
- Next by Date: Re: [ counting sort ideea... ]
- Previous by thread: [ counting sort ideea... ]
- Next by thread: Re: [ counting sort ideea... ]
- Index(es):