Example #1
0
        static void Main(string[] args)
        {
            Lista lista = new Lista(231);

            DodajElement(ref lista, 332);
            DodajElement(ref lista, 3415);
            DodajElement(ref lista, 4342);
            DodajElement(ref lista, 1252);



            Console.WriteLine("- WyświetlListe -------------\n");
            WyświetlListe(lista);

            sortowanieBabelkowe(lista);

            Console.WriteLine("\n- WyświetlListe -------------\n");
            WyświetlListe(lista);

            Console.ReadKey();
        }
Example #2
0
        static void sortowanieBabelkowe(Lista l)
        {
            bool czy_swapowal = false;

            do
            {
                Lista aktualny = l;
                czy_swapowal = false;

                while (aktualny.next != null)
                {
                    if (aktualny.next.wartosc > aktualny.wartosc)
                    {
                        int tmp = aktualny.wartosc;
                        aktualny.wartosc      = aktualny.next.wartosc;
                        aktualny.next.wartosc = tmp;

                        czy_swapowal = true;
                    }

                    aktualny = aktualny.next;
                }
            }while (czy_swapowal);
        }
Example #3
0
 static void UsuńPrzód(ref Lista l)
 {
     l = l.next;
 }