Exemplo n.º 1
0
        public void MajorityVote()
        {
            string result = MajorityElement.MajorityVote(new[] { 3, 1, 3, 3, 2 }, 0);

            Console.WriteLine(result); // Should print "3"
            result = MajorityElement.MajorityVote(new[] { 1, 2, 3 });
            Console.WriteLine(result); // Should print "NO Majority Element"
        }
Exemplo n.º 2
0
        public void DictionaryCount()
        {
            string result = MajorityElement.DictionaryCount(new[] { 3, 1, 3, 3, 2 }, 0);

            Console.WriteLine(result); // Should print "3"
            result = MajorityElement.DictionaryCount(new[] { 1, 2, 3 });
            Console.WriteLine(result); // Should print "NO Majority Element"
        }