Problem Binary Search Tree, with preorder traverse. What other methods should I add? How can I improve it? class Bst […]
Tag: ruby
Directed Acyclic graph implementation in Ruby on Rails
Problem I have an implementation for a graph node class that I’d like to have function as a directed acyclic […]
Leap year algorithm?
Problem I wrote two functions for determining leap years. (“Kabisat” means “leap year” in Indonesia.) def kabisat? y return false […]
Putting numbers into words
Problem I have some embarrassingly long code which puts into words any number up into the trillions. As a newbie, […]
NestedHash Class
Problem I want to make a Ruby nested hash table class to avoid repeating ugly code and to keep my […]
Print lyrics of 99 Bottles of Beer
Problem I read 99 Bottles of OOP, and one of the offhand comments was that doing the 99 bottles problem […]
Rails view to list users in a zebra-striped table
Problem <% i = 0 %> <% @patients.each do |patient| %> <tr class=”<%= i % 2 == 0 ? ‘Even’ […]
String substitutions in ruby and coding style
Problem I wrote a short ruby script to generate various screenshots, and event though I am not completely new to […]
Search utility that searches through source code files
Problem I’m working on a search utility that searches through source files. It’s only the beginning of the project. It […]
ActiveRecord SQL search with a filter based on parameters
Problem For work, my colleague and I sketched this method up as a brain dump of how we want this […]