Skip to content
Back to libraryPart 1 · Foundations

1.5Sorting

Before you start

It helps to have read 1.3 Arrays and strings and 1.4 Counting and frequency. Overall level: Foundation.

Practice: Sorting

0 of 4 solved

About these problems

Apply, Connect, Reason and Stretch describe difficulty within this topic, not an official contest rating. Open any problem in any order; reading the chapter first is optional.

  1. 1Ordered readingsPrint the input values in nondecreasing order.ApplyNot started
  2. 2Results orderEach participant has a distinct integer id and a score. Print ids by decreasing score; equal scores are ordered by increasing id.ConnectNot started
  3. 3Closest readingsFind the smallest absolute difference between values at two different positions.ReasonNot started
  4. 4Compact coordinatesReplace every array value by its rank among the distinct values in increasing order. Ranks start at 1; equal values receive equal ranks. Print ranks in the original input order.StretchNot started

Read the lesson