Created
June 17, 2015 20:38
-
-
Save StephanieSunshine/2f800a28af22ca623ad9 to your computer and use it in GitHub Desktop.
A very basic rtree based on btree.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class Node | |
include Enumerable | |
attr_accessor :data, :children | |
def initialize( data ) | |
@data = data | |
@children = Array.new | |
end | |
end | |
myTop = Node.new(100) | |
myTop.children.push(Node.new(50)) | |
myTop.children.push(Node.new(44)) | |
myTop.children.push(Node.new(12)) | |
myTop.children.push(Node.new(10)) | |
myTop.children.each do | myChild | | |
myChild.children.push(Node.new(50)) | |
myChild.children.push(Node.new(44)) | |
myChild.children.push(Node.new(12)) | |
myChild.children.push(Node.new(10)) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment