Priority Queue remove complexity time

前端 未结 3 1697
一向
一向 2020-12-05 09:51

What is the complexity (big-oh) for the remove() function on the Priority Queue class in Java? I can\'t find anything documented anywhere, I think it\'s O(n), c

3条回答
  •  攒了一身酷
    2020-12-05 10:33

    According to Oracle documentation: "Implementation note: this implementation provides O(log(n)) time for the enqueing and dequeing methods (offer, poll, remove() and add); linear time for the remove(Object) and contains(Object) methods; and constant time for the retrieval methods (peek, element, and size)."

    Link here to Oracle Doc

提交回复
热议问题