Блог пользователя Hoyda

Автор Hoyda, история, 6 лет назад, По-английски

There is an array A of N numbers and some number K(you will be given N and K. N<1000,sqrt(N)<=K<=N). You can only query for K indices( indices are a subset of {0,1...N-1} ) and you will get them in sorted order.

What is the best strategy for sorting this array in minimum number of queries?

  • Проголосовать: нравится
  • +11
  • Проголосовать: не нравится

»
6 лет назад, # |
Rev. 7   Проголосовать: нравится 0 Проголосовать: не нравится

Up, maybe someone wants to solve it.

One example: (Computer) - 6(N) 3(K) - 2 1 0 - 3 4 5 - 3 2 4 - 1 5 0 - 2 4 1 (Player) - 0 1 2 - 3 4 5 - 2 3 4 - 1 0 5 - 1 4 2
- 3 2 4 1 5 0(Player finds answer)

  • »
    »
    6 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    Maybe you should give some necessary details, like:

    "What is the best strategy for sorting this array" so I suppose we're getting an array in the input and we need to sort it?

    What happens when we pick indicies? does it sort them? do we just get them in sorted order?

    • »
      »
      »
      6 лет назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      We dont know values of the array. We only know its size and we can query for some subset's ordering of size K. When we are sure about complete odering we need to print its indices in sorted order and exit. When we pick indices we get them in sorted oder.