Skip to content

Function detectSubTreeRows() is incorrect #351

@kcalvinalvin

Description

@kcalvinalvin

detectSubTreeRows() for the below case fails.

position: 839, numLeaves: 300, forestRows: 9 should result in 5 but detectSubTreeRows() returns 8.

How to calculate the correct position:

  1. With 300 leaves and 9 rows, 839's parent is 931.
  2. 931's parent is 977.
  3. 977's parent is 1000, which is a root.
  4. detectRow(1000, 9) returns 5.

However, detectSubTreeRows(1000, 300, 9) returns 8.

Playground:
https://go.dev/play/p/LarcZzajT_3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions