Thread: find anagrams of sequence of words from input

  1. #1
    Registered User
    Join Date
    Aug 2016
    Posts
    4

    find anagrams of sequence of words from input

    i am tring to find anagrams of sequence of words from input, at least two words will be given up to ten word, i also need to do it in O(nlgn) run time, so i was thinking to try: 1. hash table. 2. using an array and then str compare. 3. again using an array qsort it and the char compare and str compare. 4. again using an array but this time using another 2d array to compare the chars given.
    do you guys think i an on the right direction? if not i would like to hear another ways to solve that. thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,625
    Using qsort() and bsearch() for everything should get you the complexity you need.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 09-14-2013, 08:16 AM
  2. Replies: 34
    Last Post: 06-22-2011, 07:07 AM
  3. Replies: 26
    Last Post: 05-03-2011, 11:52 AM
  4. Parsing First Characters From Sequence of Words
    By Cero.Uno in forum C Programming
    Replies: 6
    Last Post: 04-19-2008, 11:58 PM
  5. Counting input words
    By Soulrivers in forum C++ Programming
    Replies: 26
    Last Post: 01-17-2008, 03:06 PM

Tags for this Thread