Thread: Please help: counting string occurances using scanf and arrays

  1. #31
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Guys... very interesting discussion... but how's this helping the OP?

  2. #32
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    Depending on what such a list does contain - possibly a lot. Maybe it would be a message queue? Networking protocol stack? Maybe a slab memory pool, who knows.
    It would work "Okay" as a circular buffer, and even then only if iterations were few and far between, but that's about it.

    If you are trying to get some magic locality of reference going, you should maybe look into specific types of skip lists; specifically those built by aiming at a "Trie".

    [Edit]
    While I'm here, I feel compelled to point out that your source is horribly broken.
    It doesn't actually "store" much.
    [/Edit]

    Soma
    Last edited by phantomotap; 09-23-2011 at 04:46 AM.

  3. #33
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    Guys... very interesting discussion... but how's this helping the OP?
    Unless you plan on suggesting that a newbie implement hash maps, I'd say the suggestion to combine the string and the frequency in a structure is about the best he can do with what he has.

    Soma

  4. #34
    Registered User Maz's Avatar
    Join Date
    Nov 2005
    Location
    Finland
    Posts
    194
    Quote Originally Posted by phantomotap View Post
    It would work "Okay" as a circular buffer, and even then only if iterations were few and far between, but that's about it.

    If you are trying to get some magic locality of reference going, you should maybe look into specific types of skip lists; specifically those built by aiming at a "Trie".

    [Edit]
    While I'm here, I feel compelled to point out that your source is horribly broken.
    It doesn't actually "store" much.
    [/Edit]

    Soma
    Since it looks like the OP has not been interested in commenting this topic lately, I would like to ask which part of my source was so horribly broken? I simply do not spot that myself. So please someone point that out for me? (I asked phantomotap to do it via PM, but got answer telling me to find it out by testing the source - I tried it out and still did not spot the weak part :/ )

  5. #35
    Registered User Nancy Franklin's Avatar
    Join Date
    Sep 2011
    Posts
    15
    Thanks for all your help, guys. I figured out the rest, and it's working.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Counting Occurances of a Character
    By eeengenious in forum C Programming
    Replies: 5
    Last Post: 03-31-2011, 07:50 AM
  2. Replies: 18
    Last Post: 09-28-2010, 11:07 AM
  3. Counting String Occurances
    By Lesaras in forum C++ Programming
    Replies: 5
    Last Post: 12-14-2006, 09:43 AM
  4. Need help fast with counting consecutive occurances
    By c_323_h in forum C++ Programming
    Replies: 1
    Last Post: 07-04-2006, 12:48 AM
  5. occurances of string in a file
    By MB1 in forum C++ Programming
    Replies: 3
    Last Post: 03-28-2005, 04:03 PM

Tags for this Thread