Skip to content

Conversation

@Jeevan-23
Copy link

Summary:
Added a clean and efficient implementation of the Trie (Prefix Tree) data structure under com.thealgorithms.datastructures.tries.

Details:

Implements standard insert, search, and startsWith operations.

Uses an array-based node representation (TrieNode[26]) to efficiently handle lowercase English letters ('a'–'z').

Removed use of HashMap to comply with repository code quality rules and eliminate the DMC_DUBIOUS_MAP_COLLECTION warning.

Fully documented with Javadoc for readability and maintainability.

Complexity:

Insert: O(n)

Search: O(n)

Prefix check: O(n)
(where n is the length of the input string)

Testing:
Verified insertion, lookup, and prefix matching using sample words to ensure correctness and build stability.

  • [ x] I have read CONTRIBUTING.md.
  • [x ] This pull request is all my own work -- I have not plagiarized it.
  • [x ] All filenames are in PascalCase.
  • [ x] All functions and variable names follow Java naming conventions.
  • [x ] All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
  • [ x] All new code is formatted with clang-format -i --style=file path/to/your/file.java

@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 0% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.35%. Comparing base (b316dcf) to head (7e37a23).
⚠️ Report is 1 commits behind head on update-directory.

Files with missing lines Patch % Lines
...a/com/thealgorithms/datastructures/tries/Trie.java 0.00% 29 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                   @@
##             update-directory    #6787      +/-   ##
======================================================
- Coverage               77.46%   77.35%   -0.12%     
- Complexity               6257     6258       +1     
======================================================
  Files                     725      726       +1     
  Lines                   20894    20923      +29     
  Branches                 4071     4077       +6     
======================================================
- Hits                    16185    16184       -1     
- Misses                   4075     4105      +30     
  Partials                  634      634              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DenizAltunkapan DenizAltunkapan force-pushed the update-directory branch 9 times, most recently from fd72704 to 63d7653 Compare October 16, 2025 09:37
@alxkm alxkm deleted the branch TheAlgorithms:update-directory October 16, 2025 10:13
@alxkm alxkm closed this Oct 16, 2025
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.

3 participants