0

[removed code per academic honesty guidelines]

2
  • Please don't post solution code. Please edit your post to show us the check50 results so we can better help. If the challenge is timing out, that means that your program is taking too long (to qualify for the big board, you should be getting times around 1-2 seconds for the large texts.)
    – curiouskiwi
    Commented Apr 3, 2018 at 1:47
  • It means that while running your program died with signal SIGSEGV (on Linux and most other UNIXes), also known as segmentation fault. You had undefined behavior somewhere in your program.
    – Rustam A.
    Commented Oct 30, 2019 at 22:45

1 Answer 1

0

You're doing a hash table, right?

A hash table only works well if your individual table entries (whether you are storing them as a linked list or some kind of tree) contain as few words as possible. And the table entry with the most words dominates your check time.

So to speed up the algorithm, you would have to have a large hash table (at least a few thousand entries for a large dictionary), and have a hash function that distributes the words evenly.

2
  • i am still stuck at big board part,not i am getting expected exit code 0,not 1. i have also increased the hashsize of hash table to3000. take a look at my hash function,should i replace it .int hash(const char* string) { int i=0; for(int k=0,lenght=strlen(string);k<lenght;k++) { i=i+string[i]; } i= i%hashsize; return i; } Commented Apr 4, 2018 at 3:17
  • Maybe multiply the hash by a number that is relatively prime to the hash table size (they don't share prime factors) before you add the next letter.
    – Blauelf
    Commented Apr 4, 2018 at 6:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .