Skip to content

protocol for multiple solutions #383

@keon

Description

@keon
Owner

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.

Activity

goswami-rahul

goswami-rahul commented on Jul 27, 2018

@goswami-rahul
Collaborator

(+1) for the refactor.

self-assigned this
on Jul 28, 2018
danghai

danghai commented on Jul 28, 2018

@danghai
Collaborator

I like this idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @keon@danghai@goswami-rahul

      Issue actions

        protocol for multiple solutions · Issue #383 · keon/algorithms