[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] What is the time complexity of length() on a hash?
From: |
arnold |
Subject: |
Re: [bug-gawk] What is the time complexity of length() on a hash? |
Date: |
Mon, 19 Dec 2016 20:31:33 -0700 |
User-agent: |
Heirloom mailx 12.4 7/29/08 |
Peng Yu <address@hidden> wrote:
> Hi, I am wondering what the time complexity of length() on a hash is
> in awk. Does it depend on the length of the hash? Or it is a constant?
> Thanks.
>
> --
> Regards,
> Peng
It depends upon the implementation. In gawk it's constant, since gawk
keeps track of the total number of elements in an associative array
but there's no formal requirement that an awk implementation work that way.
Arnold