Skip to content

Conversation

lexorus
Copy link

@lexorus lexorus commented Oct 8, 2020

Checklist

Description

Currently Trie().contains(word: "", matchPrefix: true)) will return false, which is wrong since the root node of a Trie is considered an empty string. This PR fixes this bug. More information can be found here or by checking implementations of Trie data structure in other languages.
There is actually already a test written for this, which is failing at the moment. So this PR also makes tests for Trie data structure to pass.

What has been done

  1. Fix contains function to return true for empty string
  2. Update Trie project to Swift 5. No code changes were required.
  3. Removed useless UI tests.

How to test

Open Trie.xcodeproj and make sure project builds and tests are passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant