2023-10-31
This commit is contained in:
parent
49002af1f8
commit
8053b56b0a
6 changed files with 10 additions and 10 deletions
|
@ -12,7 +12,7 @@ lang: en
|
||||||
|
|
||||||
In a two-dimensional array, data is stored row-wise. Consider an algorithm for obtaining
|
In a two-dimensional array, data is stored row-wise. Consider an algorithm for obtaining
|
||||||
a *Cartesian product* by columns using three nested loops. The number of rows and columns
|
a *Cartesian product* by columns using three nested loops. The number of rows and columns
|
||||||
of the table can be arbitrary. We multiply the columns sequentially and accumulate the
|
can be arbitrary. We multiply the columns of the table sequentially and accumulate the
|
||||||
result. The values do not necessarily have to be populated — we discard the null elements.
|
result. The values do not necessarily have to be populated — we discard the null elements.
|
||||||
|
|
||||||
For example, let's take a partially filled *jagged two-dimensional array*:
|
For example, let's take a partially filled *jagged two-dimensional array*:
|
||||||
|
|
|
@ -12,7 +12,7 @@ lang: en
|
||||||
|
|
||||||
Consider a problem where you need to get all possible combinations of sequence elements, in which
|
Consider a problem where you need to get all possible combinations of sequence elements, in which
|
||||||
the number of elements in the combination does not exceed a given maximum, and let's write a method
|
the number of elements in the combination does not exceed a given maximum, and let's write a method
|
||||||
in Java with the appropriate filter for the minimum and maximum number of elements.
|
for solving in Java with the appropriate filter for the minimum and maximum number of elements.
|
||||||
|
|
||||||
*[Table setting problem](#table-setting-problem) • [Method for solving in Java](#combinations-of-length)*
|
*[Table setting problem](#table-setting-problem) • [Method for solving in Java](#combinations-of-length)*
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ loops.
|
||||||
{%- capture article_brief %}
|
{%- capture article_brief %}
|
||||||
Consider a problem where you need to get all possible combinations of sequence elements, in which
|
Consider a problem where you need to get all possible combinations of sequence elements, in which
|
||||||
the number of elements in the combination does not exceed a given maximum, and let's write a method
|
the number of elements in the combination does not exceed a given maximum, and let's write a method
|
||||||
in Java with the appropriate filter for the minimum and maximum number of elements.
|
for solving in Java with the appropriate filter for the minimum and maximum number of elements.
|
||||||
|
|
||||||
An *arrangement* is an ordered set of {`k`} distinct elements from a set of {`n`} distinct elements,
|
An *arrangement* is an ordered set of {`k`} distinct elements from a set of {`n`} distinct elements,
|
||||||
where {<code>k ≤ n</code>}. If {<code>k = n</code>}, then this ordered set
|
where {<code>k ≤ n</code>}. If {<code>k = n</code>}, then this ordered set
|
||||||
|
@ -39,7 +39,7 @@ a special case of *arrangement*.
|
||||||
{%- capture article_brief %}
|
{%- capture article_brief %}
|
||||||
In a two-dimensional array, data is stored row-wise. Consider an algorithm for obtaining
|
In a two-dimensional array, data is stored row-wise. Consider an algorithm for obtaining
|
||||||
a *Cartesian product* by columns using three nested loops. The number of rows and columns
|
a *Cartesian product* by columns using three nested loops. The number of rows and columns
|
||||||
of the table can be arbitrary. We multiply the columns sequentially and accumulate the
|
can be arbitrary. We multiply the columns of the table sequentially and accumulate the
|
||||||
result. The values do not necessarily have to be populated — we discard the null elements.
|
result. The values do not necessarily have to be populated — we discard the null elements.
|
||||||
{%- endcapture %}
|
{%- endcapture %}
|
||||||
{%- assign articles = articles | push: article_brief %}
|
{%- assign articles = articles | push: article_brief %}
|
||||||
|
|
|
@ -11,7 +11,7 @@ date: 2021.09.13
|
||||||
|
|
||||||
В двухмерном массиве данные хранятся построчно. Рассмотрим алгоритм получения *декартова
|
В двухмерном массиве данные хранятся построчно. Рассмотрим алгоритм получения *декартова
|
||||||
произведения* по столбцам с использованием трёх вложенных циклов. Количество строк и
|
произведения* по столбцам с использованием трёх вложенных циклов. Количество строк и
|
||||||
колонок таблицы может быть произвольным. Последовательно перемножаем колонки и накапливаем
|
колонок может быть произвольным. Последовательно перемножаем колонки таблицы и накапливаем
|
||||||
результат. Значения необязательно должны быть заполнены — нулевые элементы отбрасываем.
|
результат. Значения необязательно должны быть заполнены — нулевые элементы отбрасываем.
|
||||||
|
|
||||||
Для примера возьмём частично заполненный *зубчатый двухмерный массив*:
|
Для примера возьмём частично заполненный *зубчатый двухмерный массив*:
|
||||||
|
|
|
@ -10,8 +10,8 @@ date: 2021.09.20
|
||||||
---
|
---
|
||||||
|
|
||||||
Рассмотрим задачу, в которой нужно получить все возможные комбинации элементов последовательности,
|
Рассмотрим задачу, в которой нужно получить все возможные комбинации элементов последовательности,
|
||||||
где количество элементов в комбинации не превышает заданного максимума, и напишем метод на Java
|
где количество элементов в комбинации не превышает заданного максимума, и напишем метод для решения
|
||||||
с соответствующим отбором по минимальному и максимальному количеству элементов.
|
на Java с соответствующим отбором по минимальному и максимальному количеству элементов.
|
||||||
|
|
||||||
*[Задача о сервировке стола](#table-setting-problem) • [Метод для решения на Java](#combinations-of-length)*
|
*[Задача о сервировке стола](#table-setting-problem) • [Метод для решения на Java](#combinations-of-length)*
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@ title_translated: Code with comments
|
||||||
{%- assign articles = articles | push: "Комбинации элементов последовательности" %}
|
{%- assign articles = articles | push: "Комбинации элементов последовательности" %}
|
||||||
{%- capture article_brief %}
|
{%- capture article_brief %}
|
||||||
Рассмотрим задачу, в которой нужно получить все возможные комбинации элементов последовательности,
|
Рассмотрим задачу, в которой нужно получить все возможные комбинации элементов последовательности,
|
||||||
где количество элементов в комбинации не превышает заданного максимума, и напишем метод на Java
|
где количество элементов в комбинации не превышает заданного максимума, и напишем метод для решения
|
||||||
с соответствующим отбором по минимальному и максимальному количеству элементов.
|
на Java с соответствующим отбором по минимальному и максимальному количеству элементов.
|
||||||
|
|
||||||
*Размещением* называется упорядоченный набор {`k`} различных элементов из множества {`n`} различных
|
*Размещением* называется упорядоченный набор {`k`} различных элементов из множества {`n`} различных
|
||||||
элементов, где {<code>k ≤ n</code>}. Если {<code>k = n</code>}, то такой
|
элементов, где {<code>k ≤ n</code>}. Если {<code>k = n</code>}, то такой
|
||||||
|
@ -38,7 +38,7 @@ title_translated: Code with comments
|
||||||
{%- capture article_brief %}
|
{%- capture article_brief %}
|
||||||
В двухмерном массиве данные хранятся построчно. Рассмотрим алгоритм получения *декартова
|
В двухмерном массиве данные хранятся построчно. Рассмотрим алгоритм получения *декартова
|
||||||
произведения* по столбцам с использованием трёх вложенных циклов. Количество строк и
|
произведения* по столбцам с использованием трёх вложенных циклов. Количество строк и
|
||||||
колонок таблицы может быть произвольным. Последовательно перемножаем колонки и накапливаем
|
колонок может быть произвольным. Последовательно перемножаем колонки таблицы и накапливаем
|
||||||
результат. Значения необязательно должны быть заполнены — нулевые элементы отбрасываем.
|
результат. Значения необязательно должны быть заполнены — нулевые элементы отбрасываем.
|
||||||
{%- endcapture %}
|
{%- endcapture %}
|
||||||
{%- assign articles = articles | push: article_brief %}
|
{%- assign articles = articles | push: article_brief %}
|
||||||
|
|
Loading…
Add table
Reference in a new issue