Skip to content

Commit

Permalink
Updated README, minor 'sort' fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
kodek16 committed Jan 3, 2018
1 parent fa637c2 commit 553d657
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# brestprog

Lections on competitive programming topics currently hosted at
[neocities](http://brestprog.neocities.org/).
A site dedicated to competitive programming in Belarus with
explanations of multiple topics in Russian.
The previous version is hosted at
[neocities](http://brestprog.neocities.org/), the redesigned
version will be eventually available on GitHub Pages.

The site is currently undergoing rewrite, the major points are
automatic tests for code listings and improved design.
automatic tests for code listings and improved styling.

## Building

To build this site locally you need to have Ruby (with RubyGems)
installed. Then, install the Bundler gem (`gem install bundler`),
and use it to install the site dependencies (`bundler install`).

To run a local server with built contents, use `jekyll serve`.
To run a local server with built contents, use `bundle exec jekyll serve`.
5 changes: 3 additions & 2 deletions topics/sort/sort.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ $$\sum_{i=1}^{N} i \in O(N^2)$$ замен.

Идея сортировки слиянием заключается в следующем: допустим мы знаем, что
массив можно разбить на две примерно равные части, и каждая из них уже
будет отсортирована. Нам нужно лишь "слить" эти две части, и мы получим
будет отсортирована. Нам нужно лишь "слить" эти две части, и мы получим
отсортированный массив.

Для слияния мы создаём новый массив, изначально пустой. Затем мы параллельно
идём по двум частям изначального массива, поддерживая два указателя, и на каждой
итерации добавляем в новый массив меньший элемент из двух текущих, сдвигая
вперёд соответствующий указатель.
вперёд соответствующий указатель. После добавления всех элементов из двух
сливаемых частей содержание нового массива копируется в изначальный массив.

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

0 comments on commit 553d657

Please sign in to comment.