chore(i18n,curriculum): update translations (#43089)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d825a367417b2b2512c87
|
||||
title: Create a Doubly Linked List
|
||||
title: Creare una lista doppiamente concatenata
|
||||
challengeType: 1
|
||||
forumTopicId: 301626
|
||||
dashedName: create-a-doubly-linked-list
|
||||
@ -8,19 +8,19 @@ dashedName: create-a-doubly-linked-list
|
||||
|
||||
# --description--
|
||||
|
||||
All of the linked lists we've created so far are singly linked lists. Here, we'll create a <dfn>doubly linked list</dfn>. As the name implies, nodes in a doubly linked list have references to the next and previous node in the list.
|
||||
Tutte le liste concatenate che abbiamo creato finora sono liste semplicemente concatenate. Qui, creeremo una lista <dfn>doppiamente concatenata</dfn>. Come suggerisce il nome, i nodi in una lista doppiamente concatenata hanno dei riferimenti ai nodi successivo e precedente nella lista.
|
||||
|
||||
This allows us to traverse the list in both directions but it also requires more memory to be used because every node must contain an additional reference to the previous node in the list.
|
||||
Questo ci permette di attraversare la lista in entrambe le direzioni, ma richiede anche più memoria perché ogni nodo deve contenere un riferimento aggiuntivo al nodo precedente nella lista.
|
||||
|
||||
# --instructions--
|
||||
|
||||
We've provided a `Node` object and started our `DoublyLinkedList`. Let's add two methods to our doubly linked list called `add` and `remove`. The `add` method should add the given element to the list while the `remove` method should remove all occurrences of a given element in the list.
|
||||
Abbiamo fornito un oggetto `Node` e abbiamo avviato il nostro `DoublyLinkedList`. Aggiungiamo due metodi alla nostra lista doppiamente concatenata chiamati `add` e `remove`. Il metodo `add` dovrebbe aggiungere l'elemento dato alla lista mentre il metodo `remove` dovrebbe rimuovere tutte le occorrenze di un dato elemento nella lista.
|
||||
|
||||
Be careful to handle any possible edge cases when writing these methods, such as deletions for the first or last element. Also, removing any item on an empty list should return `null`.
|
||||
Fai attenzione a gestire eventuali casi limite durante la scrittura di questi metodi, come le cancellazioni per il primo o l'ultimo elemento. Inoltre, la rimozione di qualsiasi elemento in una lista vuota dovrebbe restituire `null`.
|
||||
|
||||
# --hints--
|
||||
|
||||
The DoublyLinkedList data structure should exist.
|
||||
La struttura di dati DoublyLinkedList dovrebbe esistere.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -34,7 +34,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The DoublyLinkedList should have a method called add.
|
||||
La lista DoublyLinkedList dovrebbe avere un metodo chiamato add.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -51,7 +51,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The DoublyLinkedList should have a method called remove.
|
||||
La lista DoublyLinkedList dovrebbe avere un metodo chiamato remove.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -68,7 +68,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Removing an item from an empty list should return null.
|
||||
Rimuovere un elemento da una lista vuota dovrebbe restituire null.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -82,7 +82,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The add method should add items to the list.
|
||||
Il metodo add dovrebbe aggiungere elementi all'elenco.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -99,7 +99,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Each node should keep track of the previous node.
|
||||
Ogni nodo dovrebbe tenere traccia del nodo precedente.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -116,7 +116,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The first item should be removable from the list.
|
||||
Il primo elemento dovrebbe essere rimovibile dall'elenco.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -134,7 +134,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The last item should be removable from the list.
|
||||
L'ultimo elemento dovrebbe essere rimovibile dall'elenco.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d8255367417b2b2512c74
|
||||
title: Create a Priority Queue Class
|
||||
title: Creare una classe Coda di Priorità
|
||||
challengeType: 1
|
||||
forumTopicId: 301630
|
||||
dashedName: create-a-priority-queue-class
|
||||
@ -8,27 +8,27 @@ dashedName: create-a-priority-queue-class
|
||||
|
||||
# --description--
|
||||
|
||||
In this challenge you will be creating a Priority Queue. A Priority Queue is a special type of Queue in which items may have additional information which specifies their priority. This could be simply represented with an integer. Item priority will override placement order in determining the sequence items are dequeued. If an item with a higher priority is enqueued after items with lower priority, the higher priority item will be dequeued before all the others.
|
||||
In questa sfida creerai una Coda di Priorità. Una Coda Priorità è un tipo speciale di Coda in cui gli oggetti possono avere informazioni aggiuntive che ne specificano la priorità. Questa potrebbe essere semplicemente rappresentata con un numero intero. La priorità degli elementi sovrascriverà l'ordine di posizionamento nel determinare la sequenza di elementi rimossi dalla coda. Se un elemento con una priorità più alta viene accodato dopo gli elementi con priorità più bassa, l'elemento con priorità più alta sarà rimosso dalla coda prima di tutti gli altri.
|
||||
|
||||
For instance, let’s imagine we have a priority queue with three items:
|
||||
Per esempio, immaginiamo di avere una coda di priorità con tre elementi:
|
||||
|
||||
```js
|
||||
[['kitten', 2], ['dog', 2], ['rabbit', 2]]
|
||||
```
|
||||
|
||||
Here the second value (an integer) represents item priority. If we enqueue `['human', 1]` with a priority of `1` (assuming lower priorities are given precedence) it would then be the first item to be dequeued. The collection would look like this:
|
||||
Qui il secondo valore (un intero) rappresenta la priorità dell'elemento. Se accodi `['human', 1]` con una priorità di `1` (ipotizzando che le priorità più basse abbiano la precedenza) esso sarebbe il primo elemento ad essere rimosso dalla coda. La collezione assomiglierà a questa:
|
||||
|
||||
```js
|
||||
[['human', 1], ['kitten', 2], ['dog', 2], ['rabbit', 2]]
|
||||
```
|
||||
|
||||
We’ve started writing a `PriorityQueue` in the code editor. You will need to add an `enqueue` method for adding items with a priority, a `dequeue` method for removing and returning items, a `size` method to return the number of items in the queue, a `front` method to return the element at the front of the queue, and finally an `isEmpty` method that will return `true` if the queue is empty or `false` if it is not.
|
||||
Abbiamo iniziato a scrivere una `PriorityQueue` nell'editor di codice. Dovrai aggiungere un metodo `enqueue` per aggiungere elementi con una priorità, un metodo `dequeue` per rimuovere e restituire gli oggetti, un metodo `size` per restituire il numero di elementi nella coda, un metodo `front` per restituire l'elemento nella parte anteriore della coda, e infine un metodo `isEmpty` che restituirà `true` se la coda è vuota o `false` se non lo è.
|
||||
|
||||
The `enqueue` should accept items with the format shown above (`['human', 1]`) where `1` represents the priority. `dequeue` and `front` should return only the item's name, not its priority.
|
||||
Il metodo `enqueue` dovrebbe accettare gli elementi con il formato mostrato sopra (`['human', 1]`) dove `1` rappresenta la priorità. `dequeue` e `front` dovrebbe restituire solo il nome dell'elemento, non la sua priorità.
|
||||
|
||||
# --hints--
|
||||
|
||||
Your `PriorityQueue` class should have a `enqueue` method.
|
||||
La tua classe `PriorityQueue` dovrebbe avere un metodo `enqueue`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -39,7 +39,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Your `PriorityQueue` class should have a `dequeue` method.
|
||||
La tua classe `PriorityQueue` dovrebbe avere un metodo `dequeue`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -50,7 +50,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Your `PriorityQueue` class should have a `size` method.
|
||||
La tua classe `PriorityQueue` dovrebbe avere un metodo `size`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -61,7 +61,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Your `PriorityQueue` class should have a `front` method.
|
||||
La tua classe `PriorityQueue` dovrebbe avere un metodo `front`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -72,7 +72,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Your `PriorityQueue` class should have an `isEmpty` method.
|
||||
La tua classe `PriorityQueue` dovrebbe avere un metodo `isEmpty`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -83,7 +83,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Your `PriorityQueue` class should correctly keep track of the current number of items using the `size` method as items are enqueued and dequeued.
|
||||
La tua classe `PriorityQueue` dovrebbe tenere correttamente traccia del numero attuale di elementi utilizzando il metodo `size` mentre gli elementi vengono accodati e rimossi.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -102,7 +102,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The `front` method should return the correct item at the front of the queue as items are enqueued and dequeued.
|
||||
Il metodo `front` dovrebbe restituire l'elemento corretto nella parte anteriore della coda mentre gli elementi vengono accodati e rimossi.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -129,7 +129,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The `isEmpty` method should return `true` when the queue is empty.
|
||||
Il metodo `isEmpty` dovrebbe restituire `true` quando la coda è vuota.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -145,7 +145,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The priority queue should return items with a higher priority before items with a lower priority and return items in first-in-first-out order otherwise.
|
||||
La coda di priorità dovrebbe restituire gli elementi con una priorità più alta prima degli elementi con una priorità più bassa e restituire gli elementi nell'ordine first-in-first-out altrimenti.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d8256367417b2b2512c79
|
||||
title: Incidence Matrix
|
||||
title: Matrice di incidenza
|
||||
challengeType: 1
|
||||
forumTopicId: 301644
|
||||
dashedName: incidence-matrix
|
||||
@ -8,21 +8,21 @@ dashedName: incidence-matrix
|
||||
|
||||
# --description--
|
||||
|
||||
Yet another way to represent a graph is to put it in an <dfn>incidence matrix.</dfn>
|
||||
Un altro modo per rappresentare un grafico è quello di metterlo in una <dfn>matrice di incidenza.</dfn>
|
||||
|
||||
An <dfn>incidence matrix</dfn> is a two-dimensional (2D) array. Generally speaking, an incidence matrix relates two different classes of objects between its two dimensions. This kind of matrix is similar to an adjacency matrix. However, the rows and columns mean something else here.
|
||||
Una <dfn>matrice di incidenza</dfn> è un array bidimensionale (2D). In generale, una matrice di incidenza collega due classi diverse di oggetti tramite le sue due dimensioni. Questo tipo di matrice è simile a una matrice di adiacenza. Tuttavia, le righe e le colonne qui hanno un altro significato.
|
||||
|
||||
In graphs, we have edges and nodes. These will be our "two different classes of objects". This matrix will have the rows be the nodes and columns be the edges. This means that we can have an uneven number of rows and columns.
|
||||
Nei grafi, abbiamo archi e nodi. Queste saranno le nostre "due classi diverse di oggetti". In questa matrice le righe saranno i nodi e colonne saranno gli archi. Ciò significa che possiamo avere un numero diverso di righe e colonne.
|
||||
|
||||
Each column will represent a unique edge. Also, each edge connects two nodes. To show that there is an edge between two nodes, you will put a 1 in the two rows of a particular column. Below is a 3 node graph with one edge between node 1 and node 3.
|
||||
Ogni colonna rappresenterà un arco unico. Inoltre, ogni arco collegherà due nodi. Per mostrare che c'è un arco tra due nodi, si metterà un 1 nelle due righe di una particolare colonna. Di seguito è riportato un grafo a 3 nodi con un arco tra il nodo 1 e il nodo 3.
|
||||
|
||||
<blockquote> 1<br> ---<br>1 | 1<br>2 | 0<br>3 | 1</blockquote>
|
||||
|
||||
Here is an example of an `incidence matrix` with 4 edges and 4 nodes. Remember, the columns are the edges and rows are the nodes themselves.
|
||||
Ecco un esempio di una `incidence matrix` con 4 archi e 4 nodi. Ricorda, le colonne sono gli archi e le righe sono i nodi.
|
||||
|
||||
<blockquote> 1 2 3 4<br> --------<br>1 | 0 1 1 1<br>2 | 1 1 0 0<br>3 | 1 0 0 1<br>4 | 0 0 1 0</blockquote>
|
||||
|
||||
Below is a JavaScript implementation of the same thing.
|
||||
Di seguito è riportata un'implementazione JavaScript della stessa cosa.
|
||||
|
||||
```js
|
||||
var incMat = [
|
||||
@ -33,7 +33,7 @@ var incMat = [
|
||||
];
|
||||
```
|
||||
|
||||
To make a directed graph, use `-1` for an edge leaving a particular node and `1` for an edge entering a node.
|
||||
Per creare un grafo diretto, usa `-1` per un arco che lascia un particolare nodo e `1` per un arco che entra in un nodo.
|
||||
|
||||
```js
|
||||
var incMatDirected = [
|
||||
@ -44,17 +44,17 @@ var incMatDirected = [
|
||||
];
|
||||
```
|
||||
|
||||
Graphs can also have <dfn>weights</dfn> on their edges. So far, we have <dfn>unweighted</dfn> edges where just the presence and lack of edge is binary (`0` or `1`). You can have different weights depending on your application. A different weight is represented as numbers greater than 1.
|
||||
I grafi possono anche avere dei <dfn>pesi</dfn> sui loro archi. Finora, abbiamo visto archi <dfn>non ponderati</dfn> dove la sola presenza e assenza degli archi è binaria (`0` o `1`). Puoi avere pesi diversi a seconda della tua applicazione. Un peso diverso è rappresentato con un numero maggiore di 1.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Create an incidence matrix of an undirected graph with five nodes and four edges. This matrix should be in a multi-dimensional array.
|
||||
Crea una matrice di incidenza di un grafo non diretto con cinque nodi e quattro archi. Questa matrice dovrebbe essere in un array multidimensionale.
|
||||
|
||||
These five nodes have the following relationships. The first edge is between the first and second node. The second edge is between the second and third node. The third edge is between the third and fifth node. The fourth edge is between the fourth and second node. All edge weights are one and the edge order matters.
|
||||
Questi cinque nodi hanno le seguenti relazioni. Il primo arco è tra il primo e il secondo nodo. Il secondo arco è tra il secondo e il terzo nodo. Il terzo arco è tra il terzo e il quinto nodo. Il quarto arco è tra il quarto e il secondo nodo. Tutti i pesi degli archi sono uno e l'ordine dell'arco conta.
|
||||
|
||||
# --hints--
|
||||
|
||||
`incMatUndirected` should only contain five nodes.
|
||||
`incMatUndirected` dovrebbe contenere solo cinque nodi.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -69,25 +69,25 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
There should be a first edge between the first and second node.
|
||||
Dovrebbe esserci un primo arco tra il primo e il secondo nodo.
|
||||
|
||||
```js
|
||||
assert(incMatUndirected[0][0] === 1 && incMatUndirected[1][0] === 1);
|
||||
```
|
||||
|
||||
There should be a second edge between the second and third node.
|
||||
Dovrebbe esserci un secondo arco tra il secondo e il terzo nodo.
|
||||
|
||||
```js
|
||||
assert(incMatUndirected[1][1] === 1 && incMatUndirected[2][1] === 1);
|
||||
```
|
||||
|
||||
There should be a third edge between the third and fifth node.
|
||||
Dovrebbe esserci un terzo arco tra il terzo e il quinto nodo.
|
||||
|
||||
```js
|
||||
assert(incMatUndirected[2][2] === 1 && incMatUndirected[4][2] === 1);
|
||||
```
|
||||
|
||||
There should be a fourth edge between the second and fourth node.
|
||||
Dovrebbe esserci un quarto arco tra il secondo e il quarto nodo.
|
||||
|
||||
```js
|
||||
assert(incMatUndirected[1][3] === 1 && incMatUndirected[3][3] === 1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d8253367417b2b2512c6d
|
||||
title: Perform an Intersection on Two Sets of Data
|
||||
title: Eseguire un'intersezione tra due insiemi di dati
|
||||
challengeType: 1
|
||||
forumTopicId: 301709
|
||||
dashedName: perform-an-intersection-on-two-sets-of-data
|
||||
@ -8,13 +8,13 @@ dashedName: perform-an-intersection-on-two-sets-of-data
|
||||
|
||||
# --description--
|
||||
|
||||
In this exercise we are going to perform an intersection on 2 sets of data. We will create a method on our `Set` data structure called `intersection`. An intersection of sets represents all values that are common to two or more sets. This method should take another `Set` as an argument and return the `intersection` of the two sets.
|
||||
In questo esercizio ci accingiamo a eseguire un intersezione su 2 set di dati. Creeremo un metodo nella nostra struttura dati `Set` chiamato `intersection`. Un'intersezione di insiemi rappresenta tutti i valori che sono comuni a due o più insiemi. Questo metodo dovrebbe prendere un altro `Set` come argomento e restituire l' `intersection` dei due set.
|
||||
|
||||
For example, if `setA = ['a','b','c']` and `setB = ['a','b','d','e']`, then the intersection of setA and setB is: `setA.intersection(setB) = ['a', 'b']`.
|
||||
Per esempio, se `setA = ['a','b','c']` e `setB = ['a','b','d','e']`, allora l'intersezione di setA e setB è: `setA.intersection(setB) = ['a', 'b']`.
|
||||
|
||||
# --hints--
|
||||
|
||||
Your `Set` class should have a `intersection` method.
|
||||
La tua classe `Set` dovrebbe avere un metodo `intersection`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -25,7 +25,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The proper collection should be returned.
|
||||
Dovrebbe essere restituita la collezione corretta.
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
Reference in New Issue
Block a user