Skip to content

protocol for multiple solutions #383

Open
@keon

Description

@keon

There could be many ways of solving a problem.
We need to come up with a unified naming protocol as we've become a library and people expect consistency in api.

I propose that we name multiple solutions as below:

  • The most efficient approach should be the main implementation and take v1 so the main implementation will be algo_name_v1 and a wrapper named algo_name will wrap algo_name_v1.
  • The "most efficient" means the solution has the best time and memory complexity. time complexity is always preferred over memory complexity for naming.
  • the rest approaches are named as algo_name_v2 algo_name_v3 by the rank.

For example,

longest_non_repeat
will have three functions, longest_non_repeat_v1, longest_non_repeat_v2, and longest_non_repeat (which is a wrapper around v1).

People will mainly use the wrapper. If for some specific reason they want to use other solutions (ex. preference of memory complexity over time complexity), they will know how to look for other versions.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions