Skip to main content
8 events
when toggle format what by license comment
Jul 2, 2012 at 16:02 history edited KeithS CC BY-SA 3.0
added 10 characters in body
Jun 19, 2012 at 14:24 vote accept Lukasz Madon
Jun 18, 2012 at 18:55 history edited KeithS CC BY-SA 3.0
added 39 characters in body
Jun 18, 2012 at 18:50 comment added KeithS Yes, I probably mean public class MinMax<T>; I'm a C# developer by trade, and in that language generic structs are allowed. In this simple example you could just make all Ts ints and remove the generic parameter, but of course a struct like MinMax could have value elsewhere so I tried to make it more useful. Edits coming.
Jun 18, 2012 at 18:14 comment added Lukasz Madon thx for the input. 1. LinkedList - sure. If I optimize for performance I'd use ArrayList. Not only for fast random access, but also CPU cache usage. The odds that next element of an array will be in cache is very high comparing to odds that next element of a linked list will be in cache(close to 0). 2. LindkeList is implemented as a double linked list do getFirst() and getLast() should be O(1) and the rest O(n) ofc. 3. you prolly mean public class MinMax<T> not struct and return minValue. 4. Seems I didn't understand the problem correctly.
Jun 18, 2012 at 18:09 history edited KeithS CC BY-SA 3.0
added 2286 characters in body
Jun 18, 2012 at 18:04 history edited KeithS CC BY-SA 3.0
added 2286 characters in body
Jun 18, 2012 at 17:50 history answered KeithS CC BY-SA 3.0