From f0d35e0f29184c1c1b7f9e6f4d76a5e7367b558c Mon Sep 17 00:00:00 2001 From: buttercat1791 Date: Mon, 7 Jul 2025 09:04:16 -0500 Subject: [PATCH] Add time complexity notes on child sort function --- src/lib/components/publications/table_of_contents.svelte.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/components/publications/table_of_contents.svelte.ts b/src/lib/components/publications/table_of_contents.svelte.ts index afe8920..118a4ec 100644 --- a/src/lib/components/publications/table_of_contents.svelte.ts +++ b/src/lib/components/publications/table_of_contents.svelte.ts @@ -244,6 +244,9 @@ export class TableOfContents { * Nostr index event. * * @param entry The ToC entry to reorder. + * + * This function has a time complexity of `O(n log n)`, where `n` is the number of children the + * parent event has. Average size of `n` is small enough to be negligible. */ async #matchChildrenToTagOrder(entry: TocEntry) { const parentEvent = await this.#publicationTree.getEvent(entry.address);