Skip to content

In Queue the dequeue should be O(1) complexity #942

Closed

Description

@fahimfaisaal

From this Queue implementation I believe the Operation is O(n) cause the complexity of Array.prototype.shift methods is O(n), see

Activity

  1. added
    feature
    help wanted
    algorithm
    on Mar 22, 2022
  2. ayDavidGitHere commented on Mar 24, 2022

    @ayDavidGitHere
    Contributor

    Dequeue on queue works on a O(n) complexity.
    To achieve dequeue on O(1) use linked-lists.

    https://github.com/ayDavidGitHere/Javascript/tree/master/Data-Structures/Linked-List

  3. fahimfaisaal commented on Mar 24, 2022

    @fahimfaisaal
    ContributorAuthor

    Yeah, I see.

  4. appgurueu commented on Apr 1, 2022

    @appgurueu
    Collaborator

    The queue should be implemented using linked lists. The current implementation is clearly suboptimal for no good reason.

  5. raklaptudirm commented on Apr 2, 2022

    @raklaptudirm
    Member

    @fahimfaisaal Are you working on this issue?

  6. fahimfaisaal commented on Apr 2, 2022

    @fahimfaisaal
    ContributorAuthor

    Yep.. I'll send pr soon.

  7. added
    performance
    beginner-friendly
    and removed
    feature
    on May 4, 2022
  8. raklaptudirm commented on May 6, 2022

    @raklaptudirm
    Member

    @fahimfaisaal You still haven't sent a pull request. Are you working on this, or should I put this issue up for grabs?

  9. fahimfaisaal commented on May 6, 2022

    @fahimfaisaal
    ContributorAuthor

    @raklaptudirm I apologize for my latency.

  10. raklaptudirm commented on May 6, 2022

    @raklaptudirm
    Member

    #1005 fixes this.

  11. added
    code quality
    and removed
    help wanted
    on May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

algorithmbeginner-friendlycode qualityperformance

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions