Discussion:
number of apostrophes in a word
(too old to reply)
achow
2011-06-16 02:41:54 UTC
Permalink
can a word have more than one apostrophe...? It seems incredibly more
difficult to count the number of words with apostrophes if I allow
words to have more than one apostrophe.....
Alex Walter
2011-06-16 03:15:21 UTC
Permalink
Post by achow
can a word have more than one apostrophe...? It seems incredibly more
difficult to count the number of words with apostrophes if I allow
words to have more than one apostrophe.....
From trying examples with the reference executable I think that yes a
word can have more than one apostrophe. And I'm finding the case like
ab'c and ab'cd where the same apostrophe is part of two words is also a
situation which makes this problem harder. This is the last thing I have
left in the assignment and I just can't figure it out. Haha quite
frustrating.
Sang-gon
2011-06-16 05:10:42 UTC
Permalink
Post by achow
can a word have more than one apostrophe...? It seems incredibly more
difficult to count the number of words with apostrophes if I allow
words to have more than one apostrophe.....
 From trying examples with the reference executable I think that yes a
word can have more than one apostrophe. And I'm finding the case like
ab'c and ab'cd where the same apostrophe is part of two words is also a
situation which makes this problem harder. This is the last thing I have
left in the assignment and I just can't figure it out. Haha quite
frustrating.
I'm not sure how you implemented find routine, but for me it naturally
came with
find function as for handling punctuations in middle of a word.
Sammie Zhang
2011-06-16 16:53:50 UTC
Permalink
Post by Sang-gon
Post by achow
can a word have more than one apostrophe...? It seems incredibly more
difficult to count the number of words with apostrophes if I allow
words to have more than one apostrophe.....
 From trying examples with the reference executable I think that yes a
word can have more than one apostrophe. And I'm finding the case like
ab'c and ab'cd where the same apostrophe is part of two words is also a
situation which makes this problem harder. This is the last thing I have
left in the assignment and I just can't figure it out. Haha quite
frustrating.
I'm not sure how you implemented find routine, but for me it naturally
came with
find function as for handling punctuations in middle of a word.
emm.. you have to go through the whole trie-tree anyway, does it
matter it has how many '\''s ??
when the current node.letter[26] != NULL then running ++;
else.. do nothing.
if you go through all the nodes in the tree, if the node is a ' then
you would find it.
John Munnings
2011-06-16 17:14:31 UTC
Permalink
Post by Sammie Zhang
Post by Sang-gon
Post by Alex Walter
Post by achow
can a word have more than one apostrophe...? It seems incredibly more
difficult to count the number of words with apostrophes if I allow
words to have more than one apostrophe.....
From trying examples with the reference executable I think that yes a
word can have more than one apostrophe. And I'm finding the case like
ab'c and ab'cd where the same apostrophe is part of two words is also a
situation which makes this problem harder. This is the last thing I have
left in the assignment and I just can't figure it out. Haha quite
frustrating.
I'm not sure how you implemented find routine, but for me it naturally
came with
find function as for handling punctuations in middle of a word.
emm.. you have to go through the whole trie-tree anyway, does it
matter it has how many '\''s ??
when the current node.letter[26] != NULL then running ++;
else.. do nothing.
if you go through all the nodes in the tree, if the node is a ' then
you would find it.
Your answer sounds like it is counting apostrophes, not the number of
words containing apostrophes.

If you're doing it right (i.e. not modifying prototypes, properly using
apply) I would say that counting words with an apostrophe is the hardest
part of the assignment. Leaving that as the last task is definitely wise.
Alex Walter
2011-06-16 20:52:08 UTC
Permalink
Post by John Munnings
Post by Sammie Zhang
Post by Sang-gon
Post by Alex Walter
Post by achow
can a word have more than one apostrophe...? It seems incredibly more
difficult to count the number of words with apostrophes if I allow
words to have more than one apostrophe.....
From trying examples with the reference executable I think that yes a
word can have more than one apostrophe. And I'm finding the case like
ab'c and ab'cd where the same apostrophe is part of two words is also a
situation which makes this problem harder. This is the last thing I have
left in the assignment and I just can't figure it out. Haha quite
frustrating.
I'm not sure how you implemented find routine, but for me it naturally
came with
find function as for handling punctuations in middle of a word.
emm.. you have to go through the whole trie-tree anyway, does it
matter it has how many '\''s ??
when the current node.letter[26] != NULL then running ++;
else.. do nothing.
if you go through all the nodes in the tree, if the node is a ' then
you would find it.
Your answer sounds like it is counting apostrophes, not the number of
words containing apostrophes.
If you're doing it right (i.e. not modifying prototypes, properly using
apply) I would say that counting words with an apostrophe is the hardest
part of the assignment. Leaving that as the last task is definitely wise.
Are we allowed to modify the trie as part of an action function? Or can
it only read information from the trie?
Ashif Harji
2011-06-16 22:21:28 UTC
Permalink
Are we allowed to modify the trie as part of an action function? Or can it
only read information from the trie?
You cannot modify the trie in any way in an action routine. It can only
read information from the trie.

ashif

Loading...