Beispiel #1
0
        public WordSet[] VowelDivide()
        {
            var vovel = ("аеёиоуыэюяАЕЁИОУЫЭЮЯ").ToCharArray();

            var vWordSet = new WordSet();
            var cWordSet = new WordSet();

            var el = First;

            while (el != null)
            {
                for (int i = 0; i < vovel.Length; i++)
                {
                    if (vovel[i] == el.Info[0])
                    {
                        vWordSet.AddLast(el.Info);
                        break;
                    }
                    else
                    {
                        cWordSet.AddLast(el.Info);
                        break;
                    }
                }

                el = el.Next;
            }

            return(new WordSet[] { cWordSet, vWordSet });
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var arr = new string[] { "абмьаылдм", "ябмьаылдм", "вбмьаылдм", "кбмьаылдм", "лбмьаылдм" };

            var wrd = new WordSet(arr);

            wrd.Out("new");
        }
Beispiel #3
0
        public WordSet NewWordSetByWordLength(int l)
        {
            var wordList = new List <string>();
            var el       = First;

            while (el != null)
            {
                if (el.Info.Length == l)
                {
                    wordList.Add(el.Info);
                }
                el = el.Next;
            }
            var fixedLengthWordSet = new WordSet(wordList.ToArray());

            return(fixedLengthWordSet);
        }
Beispiel #4
0
        public WordSet(WordSet wrd1, WordSet wrd2)
        {
            if (!wrd1.IsOrdered() || !wrd2.IsOrdered())
            {
                throw new Exception("Список не упорядочен");
            }

            var el1 = wrd1.First;
            var el2 = wrd2.First;
            var wrd = new WordSet();

            while (el1 != null && el2 != null)
            {
                if (el1.Info.CompareTo(el2.Info) < 0)
                {
                    wrd.AddLast(el1.Info);
                    el1 = el1.Next;
                }
                else
                {
                    wrd.AddLast(el2.Info);
                    el2 = el2.Next;
                }
            }
            if (el1 == null)
            {
                while (el2 != null)
                {
                    wrd.AddLast(el2.Info);
                    el2 = el2.Next;
                }
            }
            else
            {
                while (el1 != null)
                {
                    wrd.AddLast(el1.Info);
                    el1 = el1.Next;
                }
            }
            First = wrd.First;
        }