ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Общий форум

How to compute the inversions?
Послано Vladimir Milenov Vasilev 26 май 2003 22:51
The problems is to find the inversions( given a permutation of the
numbers 1,2,3,...,n (a1,a2,...,an) find number of  pairs (ai,aj) such
that i < j and ai>aj
How to solve this? I think I know a solution with complexity n*sqrt
(n), is there better? And some good realization? If you know, you can
write to me on :   vladovasilev@abv.bg

Thanks! :)
O(n log n) :) (-)
Послано Miguel Angel 26 май 2003 23:34
> The problems is to find the inversions( given a permutation of the
> numbers 1,2,3,...,n (a1,a2,...,an) find number of  pairs (ai,aj)
such
> that i < j and ai>aj
> How to solve this? I think I know a solution with complexity n*sqrt
> (n), is there better? And some good realization? If you know, you
can
> write to me on :   vladovasilev@abv.bg
>
> Thanks! :)
Don't you read Cormen? (+)
Послано Mad Mouse 27 май 2003 00:34
Look in Cormen's book on algorithms (chapter 1) :)