0

Just changed the helpers.c file according to pset3 specs:"Re-write search in such a way that it uses linear search, returning true if value is in values and false if value is not in values. Take care to return false right away if n isn’t even positive."

It passes check50 but when i run ./generate 1000 50 | ./find 127 it cant find needle in haystack.. I am now starting to dive into pset3 but i cant seem to find wheres the mistake

Here is my code:

[Edit: code removed per Honor Code compliance.]

2
  • Just a shot in the dark, since you didn't post any code, but check50 only tests with very small lists of numbers ( < 5 elements ). Is it possible that your code isn't handling 1000 elements?
    – Cliff B
    Oct 9, 2015 at 21:12
  • thanks cliff just added the code Oct 9, 2015 at 21:31

2 Answers 2

1

There appears to be a good reason that you can't find the problem. There isn't one. I ran your code and it works fine.

Is it possible you executed the command ./generate 1000 50 | ./find 128 ? There's no 128 in that list.

Or is it possible that the executable that you're testing isn't compiled from the good source code?

1
  • Thanks Cliff, I executed the command with ./find127 so the problem isnt there what do you mean by "good source code"? I oppened the helper.c file that was inside ~/Dropbox/pset3/find , edited and saved it in the same directory as asked int the pset3 specs.. Oct 9, 2015 at 22:16
0

sorry Cliff i got it now.. just re read the pset specs and found I only had to run make and not make helpers so there it was my mistake lol

thanks for the help

0

You must log in to answer this question.

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