Beispiel #1
0
        public static bool checkPalindrom(String s)
        {
            String    firstRead  = s;
            String    secondRead = "";
            stackChar stack      = new stackChar(s.Length);

            for (int i = 0; i < s.Length; i++)
            {
                stack.Push(s[i]);
            }

            for (int j = 0; j < s.Length; j++)
            {
                secondRead += stack.Top(); stack.Pop();
            }

            if (firstRead.Equals(secondRead, StringComparison.CurrentCultureIgnoreCase))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        public static String infix2PostFix(String infix)
        {
            String postFix = "";

            stackChar stack = new stackChar(infix.Length / 2);

            for (int i = 0; i < infix.Length; i++)
            {
            }
            return(postFix);
        }
Beispiel #3
0
        public static String reverseString(String s)
        {
            String    result = "";
            stackChar stack  = new stackChar(s.Length);

            for (int i = 0; i < s.Length; i++)
            {
                stack.Push(s[i]);
            }

            for (int j = 0; j < s.Length; j++)
            {
                result += stack.Top(); stack.Pop();
            }

            return(result);
        }