From: Peter Suk Date: 2005-04-23T09:31:38+09:00 Subject: Question: Time efficiency of Array << Forgive the newbie-ish question. I have been playing around with Array, and discovered the << operator: irb(main):001:0> array = [1, 2, 3, 4] => [1, 2, 3, 4] irb(main):002:0> array2 = array << 5 => [1, 2, 3, 4, 5] irb(main):003:0> array => [1, 2, 3, 4, 5] irb(main):004:0> array2 => [1, 2, 3, 4, 5] irb(main):005:0> I am curious about the time & space complexity of n << operations to an array. Is it O(n^2) or is it O(n)? Is there a doubling of allocated space going on behind the scenes? --Peter -- There's neither heaven nor hell, save what we grant ourselves. There's neither fairness nor justice, save what we grant each other.