private static void TestInsertionSortList() { InsertionSortList instance = new InsertionSortList(); Console.WriteLine(instance.Solution(new[] { 3, 2, 4 })); Console.WriteLine(instance.Solution(new[] { 4, 2, 1, 3 })); }
public void TestInsertionSortList() { var head = MyLinkList.BuildListNodeFromArray(new[] { 3, 5, 2, 6, 7, 4, 1 }); var dummy = InsertionSortList.Sort(head); Assert.AreEqual(dummy.Next.Val, 1); Assert.AreEqual(dummy.Next.Next.Next.Val, 3); Assert.AreEqual(dummy.Next.Next.Next.Next.Next.Val, 5); Assert.AreEqual(dummy.Next.Next.Next.Next.Next.Next.Next.Val, 7); }
public SoundSystem(Vector2 minMaxDistance, int maxAudibleVoices, CustomReadFileMethodDelegate customReadFileMethod) { _3DMinMaxDistance = minMaxDistance; CustomReadFileMethod = customReadFileMethod; #if DEBUG_JMOD AudioDevice = new XAudio2(XAudio2Flags.DebugEngine, ProcessorSpecifier.AnyProcessor); #else AudioDevice = new XAudio2(XAudio2Flags.None, ProcessorSpecifier.AnyProcessor); #endif freeVoices = new Stack <SourceVoiceSlot>(maxAudibleVoices); usedVoices = new InsertionSortList <SourceVoiceSlot>(new SourceVoiceSlot.SlotComparer()); for (int i = 0; i < maxAudibleVoices; i++) { freeVoices.Push(new SourceVoiceSlot(this)); } virtualChannels = new InsertionSortList <Channel>(new Channel.ImportanceComparer()); }