Character frequency counting

This is a discussion on Character frequency counting within the C Programming forums, part of the General Programming Boards category; << split from http://cboard.cprogramming.com/c-pro...-%2A%2Att.html >> To analysing a string, then finding the char whose counts of appearing in string is ...

  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    168

    Character frequency counting

    << split from what are *tt different from **tt? >>
    To analysing a string, then finding the char whose counts of appearing in string is max.
    how to solve this question?

    for example:
    Code:
    char *string = "ab---ebbbe";
    the appearing counts of char 'b'  is max. It is 3.
    I now think two method.
    one is :
    Code:
    sort(string);
    statisticalCountofChar(string);
    the other is
    Code:
    char *individualofChar;
    for ( string )
    {
          for ( *individualofChar )
          {
                caculateCountofChar();
          }
    }
    is there even more better method to solve this question?
    how to solve this question using HASHING TABLE? how to design hashing function ?

  2. #2
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Hijacking your own thread. Now that's funny.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,659
    Should've deleted the chuffin thing
    how to solve this question?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Character frequency table
    By raidkridley in forum C Programming
    Replies: 1
    Last Post: 02-12-2009, 05:31 AM
  2. need help with 'character counting from a .txt file'
    By master_vst in forum C Programming
    Replies: 5
    Last Post: 11-09-2008, 01:17 PM
  3. get wide character and multibyte character value
    By George2 in forum C++ Programming
    Replies: 27
    Last Post: 01-27-2008, 04:10 AM
  4. about program that counts a character frequency
    By Unregistered in forum C++ Programming
    Replies: 15
    Last Post: 04-23-2002, 01:21 PM
  5. Character counting program
    By TankCDR in forum C++ Programming
    Replies: 5
    Last Post: 04-05-2002, 09:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21