Averages/Mode: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: added syntax colouring the hard way)
(add BQN)
Line 395: Line 395:
<pre>Mode(s) of a() = 6
<pre>Mode(s) of a() = 6
Mode(s) of b() = 1 4</pre>
Mode(s) of b() = 1 4</pre>

=={{header|BQN}}==

[https://mlochbaum.github.io/bqncrate/?q=mode# BQNcrate] lists two functions for mode. Of these, the first is faster.

<pre>Mode1 ← ⌈´⊸=∘⊒⊸/
Mode2 ← ⊏∘⊑˘·(⌈´⊸=≠¨)⊸/⊐⊸⊔

arr ← 1‿1‿1‿1‿2‿2‿2‿3‿3‿3‿3‿4‿4‿3‿2‿4‿4‿4‿5‿5‿5‿5‿5
•Show Mode1 arr
•Show Mode2 arr</pre>
<pre>⟨ 3 4 5 ⟩
⟨ 3 4 5 ⟩</pre>


=={{header|C}}==
=={{header|C}}==