Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into update/schedule-2024q4
Browse files Browse the repository at this point in the history
  • Loading branch information
WiiJoy committed Sep 7, 2024
2 parents c9b423f + a334ac0 commit 801dd16
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 9 deletions.
23 changes: 16 additions & 7 deletions stage0/modules/data-structures-part-1/algorithms.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,16 +234,25 @@ binarySearchRecursiveMethod(arr, 5); // -1

### Двоичное дерево

- Двоичное дерево — структура данных, в которой каждый узел имеет максимум два дочерних элемента. Дочерние элементы бывают левым и правым.
Ключ левого дочернего узла меньше, чем у родительского.
Ключ правого дочернего узла больше, чем у родительского.
- Двоичное дерево — это такая структура данных, в которой каждый узел имеет максимум два дочерних элемента. Дочерние элементы бывают левым и правым. Деревья разработаны для оптимизирования списка и сортировки. Используются для создания двоичных деревьев поиска.

![Binary tree](./images/binary-tree.png)

#### Двоичное дерево поиска

Двоичное дерево с помощью сравнивания ключей решает, в каком направлении следовать к дочернему узлу.

- Ключ левого дочернего узла меньше, чем у родительского.
- Ключ правого дочернего узла больше, чем у родительского.
- Не может быть дублирующих узлов.
- Оптимальны для сортировки и поиска.

- Эффективность («О» большое):
- Индексирование: O(log n).
- Поиск: O(log n).
- Вставка: O(log n).
- Индексирование: двоичное дерево поиска — O(log n).
- Поиск: двоичное дерево поиска — O(log n).
- Вставка: двоичное дерево поиска — O(log n).

![Binary tree](./images/binary-tree.png)
![Binary search tree](./images/binary-search-tree.png)

#### Что можно сделать до старта курса

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions tasks/train-a/admin/ride.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,32 @@ Travel time is indicated for each station as _arrival time_ (except for the firs
- reason: `invalidAccessToken` (string) - Wrong token identifier

- Response 400 (application/json)

- Attributes (object)
- error:
- message: `Route not found` (string) - Error message if routeId is wrong
- reason: `recordNotFound` (string) - Unique error type

- Response 400 (application/json)

- Attributes (object)
- error:
- message: `Parameters are irrelevant` (string) - Error message if request parameters are wrong
- reason: `invalidData` (string) - Unique error type

- Response 400 (application/json)

- Attributes (object)
- error:
- message: `Time is irrelevant` (string) - Error message if time sequence is wrong
- reason: `invalidData` (string) - Unique error type

- Response 400 (application/json)
- Attributes (object)
- error:
- message: `Price is irrelevant` (string) - Error message if price sequence is wrong
- reason: `invalidData` (string) - Unique error type

### Update ride

> `(PUT) /api/route/{routeId}/ride/{rideId}`
Expand Down Expand Up @@ -178,11 +199,32 @@ Travel time is indicated for each station as _arrival time_ (except for the firs
- reason: `invalidAccessToken` (string) - Wrong token identifier

- Response 400 (application/json)

- Attributes (object)
- error:
- message: `Ride not found` (string) - Error message if routeId or rideId is wrong
- reason: `recordNotFound` (string) - Unique error type

- Response 400 (application/json)

- Attributes (object)
- error:
- message: `Parameters are irrelevant` (string) - Error message if request parameters are wrong
- reason: `invalidData` (string) - Unique error type

- Response 400 (application/json)

- Attributes (object)
- error:
- message: `Time is irrelevant` (string) - Error message if time sequence is wrong
- reason: `invalidData` (string) - Unique error type

- Response 400 (application/json)
- Attributes (object)
- error:
- message: `Price is irrelevant` (string) - Error message if price sequence is wrong
- reason: `invalidData` (string) - Unique error type

### Delete ride

> `(DELETE) /api/route/{routeId}/ride/{rideId}`
Expand Down
14 changes: 14 additions & 0 deletions tasks/train-a/admin/routes.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,25 @@ Minimum 3 carriages, minimum 3 stations;
- Attributes: (object)

- Response 401 (application/json)

- Attributes (object)
- error:
- message: `Access is not granted` (string) - Error message
- reason: `invalidAccessToken` (string) - Wrong token idintifier

- Response 400 (application/json)

- Attributes (object)
- error:
- message: `Route not found` (string) - Error message if routeId is wrong
- reason: `recordNotFound` (string) - Unique error type

- Response 400 (application/json)
- Attributes (object)
- error:
- message: `Route is already used` (string) - Error message if some order exist with certain route
- reason: `recordInUse` (string) - Unique error type

## Design example

> [!WARNING]
Expand Down
7 changes: 7 additions & 0 deletions tasks/train-a/admin/stations.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,18 @@ It does not matter what the way is chosen, latitude/longitude have to be assigne
- reason: `invalidAccessToken` (string) - Wrong token idintifier

- Response 400 (application/json)

- Attributes (object)
- error:
- message: `Invalid station data` (string) - Error message
- reason: `invalidStationData` (string) - Wrong token idintifier

- Response 400 (application/json)
- Attributes (object)
- error:
- message: `Invalid station relations` (string) - Error message
- reason: `invalidStationData` (string) - Wrong token idintifier

### Delete station

> `(DELETE) /api/station/{id}`
Expand Down
6 changes: 4 additions & 2 deletions tasks/train-a/readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Train-A
# A-Train

## Welcome to the final project

Expand All @@ -22,7 +22,7 @@ Before starting, please note the following technical details:

### Technical Setup

To simulate the backend functionality, install the latest `@planess/train-a-backend@latest` npm package into your project. Modify the `src/main.ts` file as instructed:
To simulate the backend functionality, [install](https://docs.npmjs.com/downloading-and-installing-packages-locally) the latest `@planess/train-a-backend@latest` npm package into your project. Modify the `src/main.ts` file as instructed:

#### src/main.ts

Expand All @@ -38,6 +38,8 @@ import { AppComponent } from './app/app.component';
.catch((err) => console.error(err));
```

To observe current version of packages and monitor outdated list, the `npm outdated` [command](https://docs.npmjs.com/updating-packages-downloaded-from-the-registry) could be used.

### Project Data

A substantial amount of static data has been added to the database for testing purposes. This data does not accurately reflect real-world conditions but is sufficient for training.
Expand Down
15 changes: 15 additions & 0 deletions tasks/train-a/search-detail.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,26 @@ A **carriage** is a structure for transporting passengers with specific paramete
- reason: `invalidStations` (string) - Error type

- Response 400 (application/json)

- Attributes: (object)
- error:
- message: `Parameters are irrelevant` (string) - Error message
- reason: `invalidData` (string) - Error type

- Response 400 (application/json)

- Attributes: (object)
- error:
- message: `Ride is already booked` (string) - Error message
- reason: `alreadyBooked` (string) - Error type

- Response 400 (application/json)

- Attributes: (object)
- error:
- message: `Trip is expired` (string) - Error message
- reason: `invalidRide` (string) - Error type

### To cancel active order

> `(DELETE) /api/order/{orderId}`
Expand Down

0 comments on commit 801dd16

Please sign in to comment.