Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Order Complexity for Ruby Combinatoric Functions

In one of my algorithms I use Ruby's combination and permutation methods. I have to discuss this algorithms complexity. Where could I find information about their complexity/implementation?

I've tried implementing a simple 'hand made' function but the Ruby ones seem to run in near constant time!

Any information about where to look would be much appreciated.

like image 408
Charlie Egan Avatar asked Dec 29 '25 12:12

Charlie Egan


1 Answers

Implementation can be shown on the same pages you linked. Hover your mouse over the name of the combination/permutation methods, and select click to toggle source.

You can view the latest and different versions of source here at the main repo: http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/

You can read the revision history of array.c to see perhaps why/when any changes were made to the combination/permutation methods. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/array.c?view=log. This may give you some indication into complexity and design choices made by the developers.

You may even be able to ask certain contributors to the source for reasons as to why they made XYZ change to the method, they may/may not help.

like image 109
Rots Avatar answered Jan 01 '26 04:01

Rots



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!