Investigate order()-based approach to frollmax

Open
#5,903 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
r
Domain
performance

Research direction

Start with the frollmax implementation and the discussion linked in the issue. Evaluate the proposed order()-based approach against the existing algorithm, focusing on sorting costs and worst-case behavior; done means producing a reasoned assessment of whether it should be pursued.

Written by the indexing model from the issue text.

Description

froll internals
          Another algorithm that comes to mind and avoids the need to double-pass the vector ever, maybe you've seen it implemented elsewhere?
  1. Compute o=order(x)
  2. Set output to the value where x[o[1]] for o[1], ..., o[1]+k-1
  3. Find the next o[i] outside o[1], ..., o[1]+k-1
  4. Repeat until o is "empty"

Maybe it will perform poorly since it requires sorting --> best case it's O(n log n), whereas IINM this algorithm is best case O(n) (?)

But maybe it will do better in the worst case?

Originally posted by @MichaelChirico in https://github.com/Rdatatable/data.table/pull/5889#discussion_r1447122993

Dominant language
R
Stars
3.9k
Forks
1.1k
Avg merge
14h 4m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Rdatatable/data.table

All issues in Rdatatable/data.table

Similar issues

More R issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.