#ruby - 25 May 2019
« Back 1 day Forward 1 day »
[00:02:50] havenwood: xco: if you create any new objects, they'll automatically be in the ObjectSpace
[00:03:45] ruby[bot]: havenwood: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `' for nil:NilClass
[00:10:51] xco: unless you’re referring to how the list can be dynamic depending on what objects are created in the object space?
[20:03:43] rubydoc: stderr: -e:2:in `<main>': undefined local variable or method `a' for main:Object (NameError) (https://carc.in/#/r/6z90)
[20:14:06] phaul: you can do it in O(n) if you really want to by not doing hash lookup but indexing an array
[20:14:27] comet23: i'm trying to learn algorithms now and i'm having a hard time understanding how the code will be implemented
[20:16:11] phaul: sorry I have to ask. Did you write this code or are you trying to understand it while you got it from somewhere else? You say how it will be implemented, but it already is...
[20:20:49] phaul: 1.) creates a hash that maps chars of string 1. to the number of occurrences of the chars in string 1. 2.) does the same for string 2. walks the map of string 1, checking the for each count in string 1 if it matches the other map with that character. Ie checking if the strings have the same count of a given char.
[20:24:05] comet23: there is a solution that is shorter than mine and it says that's O(N) and I was wondering if my solution was O(N) and why/why not
[20:25:06] phaul: given the argument that the character set is limited, so there exists some constant that is greater than the stepps spent in hash lookup
[20:25:48] phaul: (in other words the hashes can only grow to a certain maxium size and after that they don't go anymore)
[20:27:39] phaul: O(n) means that there exists some c0,c1 constants that the number of steps required by your code is < c0 + c1 * n where n is the length of the strings
[20:28:06] comet23: i have more learning to do, thank you for telling me that i'm on the right track at least
[20:28:22] phaul: it just means that if you increase your input sizes than the run time will increase with it propotionally
[20:29:16] comet23: i wish there was something that could test that and tell you what kind of algorithm you wrote
[20:31:21] phaul: comet23: there is a pretty unfortunate theorem, that proves that a computer program cannot decide of an other computer program in finite time if it finishes or not...
[21:29:41] paprika: hi, curious i read godot is looking to support haxe lang, i was wondering since there is a ruby to haxe compiler could we (though in round about way) use ruby with godot engine once they support haxe