4 Replies Latest reply: Jun 15, 2009 1:45 AM by 795917 RSS

    TextReader / Binary Tree Sorting

    843789
      Hello, I'm trying to run the code on the bottom half of the page on

      http://burks.bton.ac.uk/burks/language/java/jnotes/c11/ex112ans.htm

      but am getting the errors:
      cannot find symbol, symbol : class TextReader and Package TextReader does not exist.

      I don't understand what TextReadrer is, is it something I need to download or create?
      Sorry if the question is stupid, I've been trying to teach myself java the last couple of days and I can't find the answer anywhere.

      Also idealy I would like to sort a list of integers instead of words, how do I go about changing this?
      Thank you.
        • 1. Re: TextReader / Binary Tree Sorting
          795917
          Hi,

          The author has created his/her own user defined class viz TextReader.

          See [http://burks.bton.ac.uk/burks/language/java/jnotes/c10/s1.htm|http://burks.bton.ac.uk/burks/language/java/jnotes/c10/s1.htm]

          There is a source code link on the web page but it looks like the resource is no more available.
          • 2. Re: TextReader / Binary Tree Sorting
            843789
            From the original text of the Link:
            This class depends on the non-standard classes TextIO and TextReader,
            You need these classes in order to use them in your program. I am pretty sure they are available on the site you linked. BTW, great tutorials
            can be found right here on sun.com: [The Java Tutorials!|http://java.sun.com/docs/books/tutorial/]
            • 3. Re: TextReader / Binary Tree Sorting
              795917
              If you like the author, David J. Eck and want to continue reading his book,then probably you must refer this link
              [http://math.hws.edu/javanotes/|http://math.hws.edu/javanotes/] for the latest edition of his online text-book.

              Good Night,
              Swapnaja
              • 4. Re: TextReader / Binary Tree Sorting
                795917
                lucymoon wrote:
                Also idealy I would like to sort a list of integers instead of words, how do I go about changing this?
                I failed to notice this part of your message.

                Here's a demo
                import java.util.*;
                
                public class Sorting
                {
                      public static void main(String[] args)
                     {
                          List<Integer> ref=new ArrayList<Integer>();
                          ref.add(1);
                          ref.add(4);
                          ref.add(2);
                          ref.add(3);
                          
                     //     Collections.sort(ref);
                          
                          Iterator<Integer> it=ref.listIterator();
                          
                          while(it.hasNext())
                          {
                            System.out.println(it.next());     
                          }
                     
                     }
                }
                Run the code with the commented satement, observe te o/p.
                Then uncomment the statement and observe the o/p

                Bye and Regards,
                swapnaja