Hi can any one solve this problem using perl? it would be great if u can send me the solution via email


Word Counting
Write a program that counts the number of times each unique word appears in the Gettysburg Address speech below.

But, in a larger sense, we can not dedicate—we can not consecrate—-we can not hallow—-this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us — that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion — that we here highly resolve that these dead shall not have died in vain — that this nation, under God, shall have a new birth of freedom — and that government of the people, by the people, for the people, shall not perish from the earth.

As output, have your program display (to stdout or a file):

Here the input text for a smaller example:

this is a bit of text and this text is short text

Here is the output of a correct program based on this example:

this: 2 is: 2 a: 1 bit: 2 of: 2 text: 3 and: 1 short: 1 Maximum: text (3) Minimum: a, and, short (1) Average occurrences: 1.75

Later overwritten with:

Hi.
This is a problem of the infamous LCA in binary trees..! I heard that this can be easily implemented in perl using a CPAN module called "bioperl". I have never used it ..so have no idea. if any one knows , or used it before..if they can write a small program for the below program..it would be great.

Thanks


Find Common Parent

A) Write a class for a "Doubly-Linked" Tree; child nodes have links to their parents and vice versa (whatever the proper term is for such a tree). This tree can be a binary tree, for simplicity, and should only have one root node.

B) Using the above class, write a subroutine, common_parent(node1, node2), which return the first parent node that the two nodes have in common. Example:

A / \ B C / \ \ D E F / G first_common_parent(F, D) = A

20071129 Janitored by Corion: Restored original content, added formatting, code tags, as per Writeup Formatting Tips


In reply to How to count no of words in a text input file? by vikramkone

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.