Skip to content

Handling 2-3-4 Tree duplicate key insertion #40

Open
@d4vidsha

Description

@d4vidsha

In the pseudocode, add an equality check and return an error if there is an attempt to insert a duplicate key.

It probably makes sense to assume that the keys are unique, as this would be the case in most database applications.

In practice, the most realistic way to deal with this would be to do an equality check and return an error if there is an attempt to insert a duplicate key.

The two options for you as a group at this point would be:

  1. Add in an equality check, and return an error if there is an attempt to insert a key that is already in the tree, or
  2. Assume there are no duplicates, and we will mention this assumption in the Overview.

The first option Is slightly preferable, but it involves a slight change in the pseudocode, and we are also a bit reluctant to burden you with changes at this late stage. If you’re OK with it, go ahead and do the equality check in the pseudocode and the animation, and send us a copy of the new pseudocode for our records, please. Otherwise, just go with assuming there are no duplicates, and please remind us to augment the Overview.

That is, we need to implement option 1 out of the two options. For context, our group only worked on option 2 due to time limitations. Option 1 will override some features from option 2 (such as the input validation, see below) which is okay to do if it means a successful implementation of option 1.

Context

Currently, the insertion input parameter does validation to ensure no duplicate keys are listed, as seen by the disclaimer Digits should be unique.
image

Reference

See related email thread for more detailed discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions