Module: CompSci
- Defined in:
- lib/compsci/simplex.rb,
lib/compsci.rb,
lib/compsci/fit.rb,
lib/compsci/node.rb,
lib/compsci/names.rb,
lib/compsci/timer.rb,
lib/compsci/fibonacci.rb,
lib/compsci/flex_node.rb,
lib/compsci/names/greek.rb,
lib/compsci/complete_tree.rb
Overview
note, this work is based on github.com/rickhull/simplex which was forked in 2017 from github.com/danlucraft/simplex which had its last commit in 2013
Defined Under Namespace
Modules: Fibonacci, Fit, Names Classes: ChildFlexNode, ChildNode, CompleteBinaryTree, CompleteQuaternaryTree, CompleteTernaryTree, CompleteTree, FlexNode, Heap, KeyNode, Node, Simplex, Timer
Class Method Summary collapse
-
.power_of?(num, base) ⇒ Boolean
thanks apeiros gist.github.com/rickhull/d0b579aa08c85430b0dc82a791ff12d6.
Class Method Details
.power_of?(num, base) ⇒ Boolean
thanks apeiros gist.github.com/rickhull/d0b579aa08c85430b0dc82a791ff12d6
4 5 6 7 8 9 |
# File 'lib/compsci.rb', line 4 def self.power_of?(num, base) return false if base <= 1 mod = 0 num, mod = num.divmod(base) until num == 1 || mod > 0 mod == 0 end |