Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logic refinement #71

Open
thomassth opened this issue Feb 4, 2023 · 0 comments
Open

logic refinement #71

thomassth opened this issue Feb 4, 2023 · 0 comments
Labels
backlog unlikely to be worked on unless certain roadblock(s) are cleared

Comments

@thomassth
Copy link
Owner

          the current time complexity is O(n^2) (`findIndex` inside a loop), can we do the following to reduce it to O(n)?

in the first loop

  • store a key-pair value {ttcId: indexOf stopBookmarks} into a dictObject

in the second loop

  • forEach item in the result, check if there is a match in the dictObject, and do your stuff if found.

spaceComplexity is still O(n)

Originally posted by @HoiPangCHEUNG in #69 (comment)

@thomassth thomassth added the backlog unlikely to be worked on unless certain roadblock(s) are cleared label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog unlikely to be worked on unless certain roadblock(s) are cleared
Projects
None yet
Development

No branches or pull requests

1 participant