chore(i8n,learn): processed translations

This commit is contained in:
Crowdin Bot
2021-02-06 04:42:36 +00:00
committed by Mrugesh Mohapatra
parent 15047f2d90
commit e5c44a3ae5
3274 changed files with 172122 additions and 14164 deletions

View File

@ -1,18 +1,26 @@
---
id: 587d8250367417b2b2512c60
title: 创建队列类
title: Create a Queue Class
challengeType: 1
videoUrl: ''
forumTopicId: 301631
dashedName: create-a-queue-class
---
# --description--
与堆栈一样队列是元素的集合。但与堆栈不同队列遵循FIFO先入先出原则。添加到队列的元素将被推送到队列的尾部或末尾并且只允许删除队列前面的元素。我们可以使用数组来表示队列但就像堆栈一样我们希望限制我们对队列的控制量。队列类的两个主要方法是enqueue和dequeue方法。 enqueue方法将元素推送到队列的尾部dequeue方法移除并返回队列前面的元素。其他有用的方法是frontsize和isEmpty方法。说明编写一个将元素推送到队列尾部的入队方法一个删除并返回前面元素的出列方法一个让我们看到前面元素的前方法一个显示长度的大小方法以及一个isEmpty方法检查队列是否为空。
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.
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.
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.
# --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.
# --hints--
您的`Queue`类应该有一个`enqueue`方法。
Your `Queue` class should have a `enqueue` method.
```js
assert(
@ -23,7 +31,7 @@ assert(
);
```
您的`Queue`类应该有一个`dequeue`方法。
Your `Queue` class should have a `dequeue` method.
```js
assert(
@ -34,7 +42,7 @@ assert(
);
```
您的`Queue`类应该有一个`front`方法。
Your `Queue` class should have a `front` method.
```js
assert(
@ -45,7 +53,7 @@ assert(
);
```
您的`Queue`类应该有一个`size`方法。
Your `Queue` class should have a `size` method.
```js
assert(
@ -56,7 +64,7 @@ assert(
);
```
您的`Queue`类应该有一个`isEmpty`方法。
Your `Queue` class should have an `isEmpty` method.
```js
assert(
@ -67,7 +75,7 @@ assert(
);
```
`dequeue`方法应该删除并返回队列的前端元素
The `dequeue` method should remove and return the front element of the queue
```js
assert(
@ -80,7 +88,7 @@ assert(
);
```
`front`方法应该返回队列的front元素的值
The `front` method should return value of the front element of the queue
```js
assert(
@ -93,7 +101,7 @@ assert(
);
```
`size`方法应该返回队列的长度
The `size` method should return the length of the queue
```js
assert(
@ -105,7 +113,7 @@ assert(
);
```
如果队列中有元素,则`isEmpty`方法应返回`false`
The `isEmpty` method should return `false` if there are elements in the queue
```js
assert(