Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
38 views

find problem with my code - CPU overload

I cannot figure out what is wrong with my code. /** * Returns true if value is in array of n values, else false. */ bool search(int value, int values[], int n) { // ensures that the n is non ...
koko loko's user avatar
0 votes
2 answers
246 views

PSET3 find having trouble. Can someone help?

For some reason bubble sort is not working. Can someone help. binary search bool search (int target, int array[],int length) { int end = length-1; int start = 0; while (array[start] < ...
user20243's user avatar
0 votes
1 answer
72 views

pset3: sort and search work in separate files, but my helpers.c doesn't work

I dealt with sorting in a separate file first, and then I dealt with searching in another file. They seem to work okay or at least worked for the numbers I feed in, but when I put them in helpers and ...
Chris's user avatar
  • 19
0 votes
1 answer
68 views

Find.c - Binary Search probable integer overflow

Here's the gist: https://gist.github.com/Securiteru/a83e4f1a028acd0b1013def793b5dcdc And the output: ... 60697 61151 61190 61275 61460 61608 61618 61746 61750 61822 62111 62178 62183 62311 62448 ...
Securiter's user avatar
0 votes
1 answer
419 views

Pset3, Find, search

In "Find" problem, something seems wrong with my binary search Algorithm, because in check50, helpers.c wouldn't compile, I tried to compile it, then it gave me this weird error: clang -fsanitize=...
Raw's user avatar
  • 9
0 votes
2 answers
163 views

Binary Search for helpers.c

so as the title suggests I am having some trouble with my implementation of binary search. So based on the logic shown in the lecture, I think my implementation is fine, indeed it works for the cases ...
Anza Khan's user avatar
1 vote
2 answers
104 views

Binary Search Pset 3 help

As my question is titled, I would appreciate help with my binary search, shown below. Currently, the search will always return false. I am almost certain that my sorting algorithm is correct, as it ...
Jason_V's user avatar
  • 182
0 votes
2 answers
161 views

Segmentation Fault pset3 for Find

I'm getting a segmentation fault error and I can't figure out why. void sort(int values[], int n) { // TODO: implement a sorting algorithm for (int i = 0; i<n; i++) { if ((n!=i+...
Alex Durante's user avatar
0 votes
1 answer
680 views

cs50x pset3 find - Need help with the counting sort

can someone please look at my code and tell me where I went wrong with my counting sort algorithm (Or binary search algorithm, if that's where the problem lies...?). Please and thank you. Binary ...
Milad's user avatar
  • 7
0 votes
1 answer
59 views

please help me with this binary search

for some reason this binary search code keeps returning true, when providing the haystack from generate.c, even if the "needle" isnt there. when manually inputing the haystack, the code runs perfectly....
David Rosenberg's user avatar
0 votes
1 answer
97 views

Pset 3: Find (more comfortable) - child exited with status 255 & exits with wrong code

I ambitiously decided to try the more comfortable version of this task, although I'm very much "less comfortable" with regard to any computer skills... Before I give up, I'd like to ask you what's ...
randomshiners's user avatar
0 votes
0 answers
218 views

PSET3 \ expected an exit code of 0, not 1 (find.c)

I successfully built my program and went on to check it using check50 only to discover this :) helpers.c exists :) helpers.c compiles :) finds 42 in {42,43,44} :) finds 42 in {41,42,43} :) finds 42 ...
Ubuntu NutCracker's user avatar
0 votes
1 answer
95 views

Pset3 Find - Not sure what is wrong with helpers.c code

I am not sure what is wrong with the code. It seems to work on some of the criteria when using cs50's check50, but does not work on others. There also does not seem to have a pattern about the wrong ...
KayZee's user avatar
  • 3
0 votes
1 answer
101 views

pset3 binary search , problems with check50

i have tried a lot but cannot find the meaning of the last two errors of check50 please help
Ketan Verma's user avatar
0 votes
1 answer
178 views

Segmentation fault in find.c

I've been working on find.c for a long time now and I've managed to get to the point where it will return the correct output when the needle is in the haystack, but when it isn't I get a segmentation ...
Danielle R's user avatar
0 votes
2 answers
67 views

binary search pset 3 pointer to integer error

I am trying my hands on binary search. I get those pointer to integer errors :( Can sonmeone more experience give me a hand ? bool search(int value, int values[], int n) { int first=0; int last=n-1; ...
hmmmbob's user avatar
  • 105
0 votes
1 answer
86 views

Recursive Binary Search Exit Code Errors

I wrote the following recursive binary search function. No matter which exit codes I use (e.g., true, false, 1, 0, -1, "Swedish Chef"), I fail at least two of the checks I need to pass. The code ...
Ryan's user avatar
  • 138
0 votes
1 answer
143 views

Odd bug for Find

I've been working of the find (problem set 3) for 2 weeks and I'm just stuck. I already have the design etc worked out but there is a bug that I seem to be missing. So the problem is that when I run ...
Caffae's user avatar
  • 1
0 votes
1 answer
411 views

Bug in my Pset3 Binary Search helpers.c

When I run check50 check50 2015.fall.pset3.find helpers.c This is the terminal result :) helpers.c exists :) helpers.c compiles :( finds 42 in {42,43,44} \ expected an exit code of 0, not 1 :) ...
Kazaky's user avatar
  • 3
0 votes
1 answer
167 views

Pset3 - Function returns both true and false in while loop

In my code, after successfully searching the element, the function is returning true and false both to the main function. I have questions as follows -> 1 - Why the sm() function is returning true ...
Priyanshu Kumawat's user avatar
0 votes
2 answers
89 views

My binary sort function cannot find the needle in the haystack. Can anyone see the bug in this code?

I am testing by using ./generate 1000 50 | ./find 127. The needle should be found but isn't. #include <stdio.h> #include <cs50.h> #include <string.h> #include "helpers.h" /** * ...
noggy's user avatar
  • 53
0 votes
1 answer
525 views

pset 3 "search": expected an exit code of 0, not 1

I'm at the very end of the "find, sort, search" section of pset3, but when using check50, I get "expected an exit code of 0, not 1". This only happens on the checks where check50 is looking for a ...
Chris's user avatar
  • 41
0 votes
1 answer
42 views

Array Initialization Problems

I am getting this error from my code: helpers.c:56:28: error: expected expression binsearch(value, values[], j, n, end); Here is the code in question: binsearch(value, values[], j, n, end); ...
mmoore's user avatar
  • 57
0 votes
0 answers
245 views

pset3 find: Bus error (core dumped)

I finished the binary search algorithm and I get an error Bus error (core dumped) when I try to test it using the generate tool which is given. However, it works fine when I input the haystacks myself....
pythonhax's user avatar
  • 146