Home

thirdhighest

Thirdhighest is a term used to denote the third-largest value in a collection of numbers or items. In computing, statistics, and data analysis, it appears in contexts such as rankings, leaderboards, and numerical summaries.

There are two common interpretations. The third-highest value counting duplicates refers to the third element when

Computing methods vary by context and data size. A simple approach is to sort the data in

Edge cases include datasets with fewer than three elements, where the third-highest may be undefined; implementations

the
data
are
sorted
in
descending
order,
allowing
repeated
values
to
occupy
multiple
positions.
The
third-highest
distinct
value,
by
contrast,
considers
only
distinct
values
after
removing
duplicates.
For
example,
in
the
list
[7,
2,
7,
4,
9,
9,
3],
the
third-highest
(counting
duplicates)
is
7,
while
the
third-highest
distinct
value
is
4.
descending
order
and
select
the
third
element.
More
efficient
methods
for
large
datasets
include
maintaining
the
top
three
values
in
a
single
pass,
or
using
a
selection
algorithm
(such
as
quickselect)
to
find
the
k-th
largest
value.
For
the
third-highest
distinct
value,
one
can
first
deduplicate
the
input
or
maintain
a
min-heap
of
the
three
largest
distinct
values.
may
return
null,
NaN,
or
the
highest
available
value.
The
concept
is
related
to
order
statistics
and
is
often
used
in
ranking,
statistics,
and
algorithm
design
to
extract
relative
positioning
within
a
dataset.
See
also:
nth
order
statistic,
top-k,
ranking.