Русские видео

Сейчас в тренде

Иностранные видео


Скачать с ютуб Trie Data Structure (EXPLAINED) в хорошем качестве

Trie Data Structure (EXPLAINED) 6 лет назад


Если кнопки скачивания не загрузились НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу страницы.
Спасибо за использование сервиса savevideohd.ru



Trie Data Structure (EXPLAINED)

Get the full course on Algorithms & Data Structures: in Javascript - https://www.udemy.com/algorithms-and-... in C++ - https://www.udemy.com/algorithms-and-... in Java - https://www.udemy.com/algorithms-data... 🔥 GET 2 MONTHS OF SKILLSHARE PREMIUM FOR FREE HERE: 🔥 https://www.skillshare.com/r/profile/... 👇SUPPORT ME BY ONE TIME DONATION👇 https://paypal.me/support930 In computer science, a trie, also called digital tree and sometimes radix tree or prefix tree (as they can be searched by prefixes), is a kind of search tree—an ordered tree data structure that is used to store a dynamic set or associative array where the keys are usually strings. Unlike a binary search tree, no node in the tree stores the key associated with that node; instead, its position in the tree defines the key with which it is associated. All the descendants of a node have a common prefix of the string associated with that node, and the root is associated with the empty string. Values are not necessarily associated with every node. Rather, values tend only to be associated with leaves, and with some inner nodes that correspond to keys of interest. For the space-optimized presentation of prefix tree, see compact prefix tree. In the example shown, keys are listed in the nodes and values below them. Each complete English word has an arbitrary integer value associated with it. A trie can be seen as a tree-shaped deterministic finite automaton. Each finite language is generated by a trie automaton, and each trie can be compressed into a deterministic acyclic finite state automaton. Though tries are usually keyed by character strings,[not verified in body] they need not be. The same algorithms can be adapted to serve similar functions of ordered lists of any construct, e.g. permutations on a list of digits or shapes. In particular, a bitwise trie is keyed on the individual bits making up any fixed-length binary datum, such as an integer or memory address. The complexity of creating a trie is O(W*L), where W is the number of words, and L is an average length of the word: you need to perform L lookups on the average for each of the W words in the set. Same goes for looking up words later: you perform L steps for each of the W words. Hash insertions and lookups have the same complexity: for each word you need to check equality, which takes O(L), for the overall complexity of O(W*L). If you need to look up entire words, hash table is easier. However, you cannot look up words by their prefix using a hash table; If prefix-based lookups are of no interest to you, use a hash table; otherwise, use a trie. class Node(): def __init__(self): self.children = # mapping from character to Node self.value = None def find(node, key): for char in key: if char in node.children: node = node.children[char] else: return None return node.value def insert(root, string, value): node = root i = 0 while i is-smaller len(string): if string[i] in node.children: node = node.children[string[i]] i += 1 else: break append new nodes for the remaining characters, if any while i is-smaller len(string): node.children[string[i]] = Node() node = node.children[string[i]] i += 1 store value in the terminal node node.value = value

Comments