chore(i18n,curriculum): update translations (#43140)
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
---
|
||||
id: 587d8250367417b2b2512c60
|
||||
title: Create a Queue Class
|
||||
title: Creare una classe Coda
|
||||
challengeType: 1
|
||||
forumTopicId: 301631
|
||||
dashedName: create-a-queue-class
|
||||
@ -8,19 +8,19 @@ dashedName: create-a-queue-class
|
||||
|
||||
# --description--
|
||||
|
||||
Like stacks, queues are a collection of elements. But unlike stacks, queues follow the FIFO (First-In First-Out) principle. Elements added to a queue are pushed to the tail, or the end, of the queue, and only the element at the front of the queue is allowed to be removed.
|
||||
Come gli stack, le code sono una raccolta di elementi. Ma a differenza degli stack, le code seguono il principio FIFO (First-In First-Out). Gli elementi aggiunti ad una coda vengono spinti in fondo, o alla fine, della coda, e solo l'elemento nella parte anteriore della coda può essere rimosso.
|
||||
|
||||
We could use an array to represent a queue, but just like stacks, we want to limit the amount of control we have over our queues.
|
||||
Potremmo usare un array per rappresentare una coda, ma proprio come per gli stack, vogliamo limitare la quantità di controllo che abbiamo sulle nostre code.
|
||||
|
||||
The two main methods of a queue class is the enqueue and the dequeue method. The enqueue method pushes an element to the tail of the queue, and the dequeue method removes and returns the element at the front of the queue. Other useful methods are the front, size, and isEmpty methods.
|
||||
I due metodi principali di una classe coda sono il metodo di accodamento e il metodo di rimozione. Il metodo di accodamento spinge un elemento in fondo alla coda, e il metodo di rimozione rimuove e restituisce l'elemento in testa alla coda. Altri metodi utili sono front, size e isEmpty.
|
||||
|
||||
# --instructions--
|
||||
|
||||
Write an `enqueue` method that pushes an element to the tail of the queue, a `dequeue` method that removes and returns the front element, a `front` method that lets us see the front element, a `size` method that shows the length, and an `isEmpty` method to check if the queue is empty.
|
||||
Scrivi un metodo `enqueue` che spinge un elemento in fondo alla coda, un metodo `dequeue` che rimuove e restituisce l'elemento in testa alla coda, un metodo `front` che permette di vedere l'elemento in testa alla coda, un metodo `size` che ne mostra la lunghezza, e un metodo `isEmpty` per controllare se la coda è vuota.
|
||||
|
||||
# --hints--
|
||||
|
||||
Your `Queue` class should have a `enqueue` method.
|
||||
La tua classe `Queue` dovrebbe avere un metodo `enqueue`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -31,7 +31,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Your `Queue` class should have a `dequeue` method.
|
||||
La tua classe `Queue` dovrebbe avere un metodo `dequeue`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -42,7 +42,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Your `Queue` class should have a `front` method.
|
||||
La tua classe `Queue` dovrebbe avere un metodo `front`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -53,7 +53,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Your `Queue` class should have a `size` method.
|
||||
La tua classe `Queue` dovrebbe avere un metodo `size`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -64,7 +64,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
Your `Queue` class should have an `isEmpty` method.
|
||||
La classe `Queue` dovrebbe avere un metodo `isEmpty`.
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -75,7 +75,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The `dequeue` method should remove and return the front element of the queue
|
||||
Il metodo `dequeue` dovrebbe rimuovere e restituire l'elemento in testa alla coda
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -88,7 +88,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The `front` method should return value of the front element of the queue
|
||||
Il metodo `front` dovrebbe restituire il valore dell'elemento in testa alla coda
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -101,7 +101,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The `size` method should return the length of the queue
|
||||
Il metodo `size` dovrebbe restituire la lunghezza della coda
|
||||
|
||||
```js
|
||||
assert(
|
||||
@ -113,7 +113,7 @@ assert(
|
||||
);
|
||||
```
|
||||
|
||||
The `isEmpty` method should return `false` if there are elements in the queue
|
||||
Il metodo `isEmpty` dovrebbe restituire `false` se ci sono elementi nella coda
|
||||
|
||||
```js
|
||||
assert(
|
||||
|
Reference in New Issue
Block a user