Skip to content

Add Trie data structure. #229

@HarsheetKakar

Description

@HarsheetKakar
Contributor

Description of the problem

Example of the problem

References/Other comments

Reference

Activity

czgdp1807

czgdp1807 commented on Mar 29, 2020

@czgdp1807
Member

Please propose an API for the Trie data structure.

HarsheetKakar

HarsheetKakar commented on Mar 29, 2020

@HarsheetKakar
ContributorAuthor

TrieNode:
The class TrieNode will extend from Node base class to represent a node in Trie
Attributes:

  • children- dict() to represent children of the node
  • is_end- Boolean to represent leaf position.

Trie:
The class Trie to represent data structure Trie.
Attributes:

  • root- start Node.

Methods:

  • insert(string): insert a string in Trie
  • search(string): takes string and returns True if full match else returns list of partial matches
  • delete(string): delete a string from Trie
czgdp1807

czgdp1807 commented on Mar 30, 2020

@czgdp1807
Member
  • _index(symbol: Char): takes in symbol and gives it index position in Node.children

Why do we need this?

czgdp1807

czgdp1807 commented on Mar 30, 2020

@czgdp1807
Member
  • children- array of None initially for number of symbols possible

Can we go for python dict with TrieNode as key?

czgdp1807

czgdp1807 commented on Mar 30, 2020

@czgdp1807
Member
  • size- total nodes in Trie

Why we need this too?

HarsheetKakar

HarsheetKakar commented on Mar 30, 2020

@HarsheetKakar
ContributorAuthor
  • children- array of None initially for number of symbols possible

Can we go for python dict with TrieNode as key?

sure, would be better

HarsheetKakar

HarsheetKakar commented on Mar 30, 2020

@HarsheetKakar
ContributorAuthor
  • _index(symbol: Char): takes in symbol and gives it index position in Node.children

Why do we need this?

not if we use dict

HarsheetKakar

HarsheetKakar commented on Mar 30, 2020

@HarsheetKakar
ContributorAuthor
  • size- total nodes in Trie

Why we need this too?

not really needed.

robotjellyzone

robotjellyzone commented on Apr 10, 2020

@robotjellyzone

Hi @HarsheetKakar are still working on this ? Any update ?

added this to the v0.0.1 milestone on May 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Participants

      @czgdp1807@robotjellyzone@HarsheetKakar

      Issue actions

        Add Trie data structure. · Issue #229 · codezonediitj/pydatastructs