Exemple #1
0
 private static void PrintSuccessorWithDeleteState(SuccesorWithDelete swd)
 {
     Console.WriteLine("Succesors:");
     Array.ForEach(Enumerable.Range(0, 10).ToArray(), (x) =>
     {
         if (swd.Successor(x, out int y))
         {
             Console.WriteLine($"Succesor of {x} is {y}");
         }
     });
 }
Exemple #2
0
        private static void RunSuccessWithDelete()
        {
            var swd = new SuccesorWithDelete(10);

            PrintSuccessorWithDeleteState(swd);
            swd.Delete(0);
            PrintSuccessorWithDeleteState(swd);
            swd.Delete(4);
            PrintSuccessorWithDeleteState(swd);
            swd.Delete(5);
            PrintSuccessorWithDeleteState(swd);
            swd.Delete(9);
            PrintSuccessorWithDeleteState(swd);
            swd.Delete(1);
            swd.Delete(3);
            swd.Delete(6);
            swd.Delete(7);
            PrintSuccessorWithDeleteState(swd);
        }