示例#1
0
        public void TestStriclyIncreasingSequenceIsAnalyzedCorrectly()
        {
            int[] expected = new[] { 1, 2, 3, 4, 5, 6 };
            var   sequence = GetSequence(1, 2, 3, 4, 5, 6);

            var subSequence = audioSequencesAnalyzer.GetLongestIncreasingSubSequence(sequence);

            Assert.AreEqual(sequence.Count, subSequence.Count());
            AssertSequenceAreEqual(expected, sequence);
        }
示例#2
0
        private IEnumerable <IEnumerable <SubFingerprintData> > GetCandidatesSortedByLCS(Dictionary <IModelReference, ISet <SubFingerprintData> > allCandidates)
        {
            var resultSet =
                new SortedSet <IEnumerable <SubFingerprintData> >(
                    Comparer <IEnumerable <SubFingerprintData> > .Create((a, b) => b.Count().CompareTo(a.Count()))); // TODO Loose comparison, if 2 sequences are equal last added will be selected as the winner

            foreach (var candidate in allCandidates)
            {
                var lcs = audioSequencesAnalyzer.GetLongestIncreasingSubSequence(candidate.Value.ToList()).ToList();
                resultSet.Add(lcs);
            }

            return(resultSet);
        }