One minute
Size vs Length Naming Convention in Elixir
Official Elixir lang documentation on naming conventions states the following:
size
in a function name indicates that it will run in a constant time - O(1)
Example: when the size of a data structure is already stored somewhere
length
in a function name indicates that it will run a linear time - O(n)
Example: when the data structure has to be traversed to find out its size
Read other posts
comments powered by Disqus