public void Assignment()
        {
            const int capacity = 10000;

            var parser = new FileParser();
            var numbers = parser.Read("Median.txt")
                .Select(i => (int)i)
                .ToArray();

            var algorithm = new MedianAlgorithm();
            long cum = numbers.Select(n => algorithm.Add(n)).Aggregate<int, long>(0, (current, median) => current + median);

            var result = cum%capacity;
            Console.WriteLine("The medians answer: {0}", result);
        }
Beispiel #2
0
        public void Assignment()
        {
            const int capacity = 10000;

            var parser  = new FileParser();
            var numbers = parser.Read("Median.txt")
                          .Select(i => (int)i)
                          .ToArray();

            var  algorithm = new MedianAlgorithm();
            long cum       = numbers.Select(n => algorithm.Add(n)).Aggregate <int, long>(0, (current, median) => current + median);

            var result = cum % capacity;

            Console.WriteLine("The medians answer: {0}", result);
        }
        private static ICollection <long> ReadNumbers()
        {
            var parser = new FileParser();

            return(parser.Read("2sum.txt"));
        }
 private static ICollection<long> ReadNumbers()
 {
     var parser = new FileParser();
     return parser.Read("2sum.txt");
 }