two parts(python). 1- class for binary tree, 2- class to output HTML, computer science homework help

In all the classes for this assignment, use of the following Python language features is mandatory:

It is strongly recommended to read and understand… and….

  1. Define a class that can be used to output an HTML report regarding word frequencies in an input text file. The report must identify the shortest word, the longest word, the most frequently used word, the least frequently used word, and a histogram of all the words used in the input file. The class, at a minimum, must have the following interface:
    • A constructor
    • Add a word
    • Write a report to file named `filename`

    The remainder of the class definition is left up to you.

  2. Write one or more classes that define a binary tree which can be used with the following main function.
    import random
    import sys
    def main( ):
      if len(sys.argv) < 2:
        print('Please provide the number of keys to enter.')
      s = int(sys.argv[1])
      parts = int(s/3)
      t = Tree( )
      r = list(range(1,s+1))
      print('Randomly inserting the numbers from 1 to {}.'.format(len(r)))
      for i in r:
        print('inserted {}'.format(i))
      f = open('', 'w')
      writeTree(t, f)
      f.flush( )
      f.close( )
      for n in range(1, 3):
        m = r[(n-1) * parts : (n * parts)]
        for i in m:
          print('removed {}'.format(i))
          v = t.remove(i)
          if v:
        c = chr(n + 97)
        filename = str(c) + '.dot'
        f = open(filename, 'w')
        writeTree(t, f)
        f.flush( )
        f.close( )

    The output of the program is a file in DOT syntax. The output of your program must be passed to the program `dot`, part of Graph Viz, to create an visualization of your tree. An example output file is the following:

    digraph BST{
            node [fontname="Helvetica"];
            7 -> 2;
            2 -> 1;
            null1 [shape=point];
            1 -> null1;
            null2 [shape=point];
            1 -> null2;
            null3 [shape=point];
            2 -> null3;
            7 -> 9;
            null4 [shape=point];
            9 -> null4;
            null5 [shape=point];
            9 -> null5;
Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
The price is based on these factors:
Academic level
Number of pages
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more
error: Content is protected !!