chore: resolve flagged Crowdin issues (#45442)
* chore: resolve bengali issues * chore: resolve french issues * chore: resolve hebrew issues * chore: resolve persian issues * chore: resolve portuguese brazilian issues * chore: resolve russian issues * chore: resolve spanish issues * chore: resolve japanese issues
This commit is contained in:
@ -12,11 +12,11 @@ Here we will move on from binary search trees and take a look at another type of
|
||||
|
||||
# --instructions--
|
||||
|
||||
Let's create a trie to store words. It will accept words through an `add` method and store these in a trie data structure. It will also allow us to query if a given string is a word with an `isWord` method, and retrieve all the words entered into the trie with a `print` method. `isWord` should return a boolean value and print should return an array of all these words as string values. In order for us to verify that this data structure is implemented correctly, we've provided a `Node` structure for each node in the tree. Each node will be an object with a `keys` property which is a JavaScript Map object. This will hold the individual letters that are valid keys of each node. We've also created an `end` property on the nodes that can be set to `true` if the node represents the termination of a word.
|
||||
Let's create a trie to store words. It will accept words through an `add` method and store these in a trie data structure. It will also allow us to query if a given string is a word with an `isWord` method, and retrieve all the words entered into the trie with a `print` method. `isWord` should return a boolean value and `print` should return an array of all these words as string values. In order for us to verify that this data structure is implemented correctly, we've provided a `Node` structure for each node in the tree. Each node will be an object with a `keys` property which is a JavaScript Map object. This will hold the individual letters that are valid keys of each node. We've also created an `end` property on the nodes that can be set to `true` if the node represents the termination of a word.
|
||||
|
||||
# --hints--
|
||||
|
||||
The Trie should have an add method.
|
||||
The `Trie` should have an `add` method.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -32,7 +32,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The Trie should have a print method.
|
||||
The `Trie` should have a `print` method.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -48,7 +48,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The Trie should have an isWord method.
|
||||
The `Trie` should have an `isWord` method.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -64,7 +64,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The print method should return all items added to the trie as strings in an array.
|
||||
The `print` method should return all items added to the trie as strings in an array.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -93,7 +93,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The isWord method should return true only for words added to the trie and false for all other words.
|
||||
The `isWord` method should return `true` only for words added to the trie and `false` for all other words.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
Reference in New Issue
Block a user