Example #1
0
def test_trie():
    trie = Trie()
    trie.insert('apple')
    assert trie.search('apple') == True
    assert trie.search('app') == False
    assert trie.startWith('app') == True
    trie.insert('app')
    assert trie.search('app') == True
Example #2
0
def test_1():
    t = Trie()
    t.insert('apple')
    t.insert('pear')
    assert t.search('apple')
    assert not t.search('app')
    assert t.startsWith('app')
Example #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from solution import Trie

trie = Trie()
trie.insert("somestring")
print(trie.search("some"))
print(trie.startsWith("some"))
print(trie.search("somestring"))
Example #4
0
def test_0():
    t = Trie()
    assert not t.search('a')
    assert not t.startsWith('sa')
Example #5
0
from solution import Trie

#basic tests
trie = Trie()

trie.insert('apple')
assert trie.search('apple')
assert not trie.search('app')
assert trie.startsWith('app')
trie.insert('app')
assert trie.search('app')