Skip to content

Commit 884ff7d

Browse files
committed
refactor: improve comments
1 parent 5647ad0 commit 884ff7d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

program/c/src/oracle/model/price_model.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
#include "../util/avg.h" /* For avg_2_int64 */
33

44
/*
5-
* In-place Heapsort implementation optimized for minimal compute unit usage in BPF.
5+
* In-place bottom-up Heapsort implementation optimized for minimal compute unit usage in BPF.
66
*
77
* Initially it creates a max heap in linear time and then to get ascending
88
* order it swaps the root with the last element and then sifts down the root.
99
*
10+
* The number of comparisions in average case is nlgn + O(1) and in worst case is
11+
* 1.5nlgn + O(n).
12+
*
1013
* There are a lot of (j-1) or (j+1) math in the code which can be optimized by
1114
* thinking of a as 1-based array. Fortunately, BPF compiler optimizes that for us.
1215
*/

0 commit comments

Comments
 (0)