Questions tagged [find]
The find tag has no usage guidance.
189 questions
0
votes
1
answer
106
views
Pset3 Sorting Help a bit of out of the scope
I was doing the sorting part and was having trouble in figuring out what file to compile as to check if my code is correct for bubble sort or not. So started searching here and someone posted here ...
0
votes
1
answer
51
views
What file am I suppose to compile to see my output in Pset3 Sorting?
Ok this is the code for sorting I have written but now I don't know what file to compile to check for my results. Because of the addition of printf() function I have added stdio.h into my helpers.c ...
0
votes
1
answer
35
views
find.c does some things which are not written in itself
In the find.c there is nothing like printf ("Retry: ") if user fails to insert a number, but it does. In the explanation of problem set it also states ctlr-d will cause to straw==INT_MAX and should ...
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);
...
0
votes
1
answer
450
views
Find.c doesn't do anything
So I've been struggling with this for some time now and now I feel I'm totally stuck. I'm done with selection sort and binary search in helpers.c, and I think they are working all right. Actually for ...
0
votes
1
answer
148
views
find will not compile
find will not compile with or without ; at the end of the statement void sort(int values[], int n).
Clang errors and my helpers file are given below.
Error message with ;
jharvard@appliance (~/...
0
votes
1
answer
223
views
Help on helpers! pset 3 - can't find the error!
everyone, i'm stuck on find/generate files, i think i wrote the right code but, the program can't find the needle, can anybody helpe me, please ?
0
votes
1
answer
243
views
pset3-helpers-expected expression
I am getting the following error when I compile my helpers file
jharvard@appliance (~/Dropbox/pset3/find): make helpers
clang -ggdb3 -O0 -std=c99 -Wall -Werror helpers.c -lcs50 -lm -o helpers
...
1
vote
1
answer
236
views
expected output not standard error
In pset3's find. I have implemented Binary search. Everything works fine when I test it. But when I test it with check50, the last test fails saying: \ expected output, not standard error of "/opt/...
0
votes
0
answers
151
views
pset3 - check50 for find returns frowny face
I must be missing something on my code for pset3.
When i run the Check50 i get this messages :
:) finds 42 in {41,42,43}
:( finds 42 in {40,41,42}
\ expected an exit code of 0, not 1
After ...
0
votes
0
answers
91
views
My linear search can't find any values. Why?
Here's the code for my pset 3, which fails to find the '127' in the stack. Any hints will be massively appreciated:
bool search(int value, int values[], int n)
{
for(int i = 0; i < n; i++)
...
0
votes
1
answer
46
views
Find Search Help (improved)
For pset3's findsearch, i saved the this code
#include "helpers.h"
bool search(int value, int values[], int n)
{
// removed implementation due to academic honesty rules
}
in helpers.c and ...
1
vote
1
answer
1k
views
How to use swap?
I am currently in pset3, implementing sort. I chose to do selection sort and at the end of it I need to swap the numbers, but when I try to compile, I get this message:
implicit declaration of ...
0
votes
2
answers
139
views
why does my find get stuck?
When I do the ./generate 1000 50 | ./find 127 command, the answer is
so that is the right answer.
But when I do the ./generate 1000 50 | ./find 128 command, the answer is
and nothing ...
0
votes
0
answers
76
views
Valgrind Error on Find
I know it's not required to run valgrind on find in pset3, but I was seeing some funky things in check50 and tried it out. The following errors appear:
==7866== 1 errors in context 1 of 2:
==7866== ...
0
votes
1
answer
134
views
pset3 find.c - error whenever code is compiled
The error is as follows:
Even looked at the stddef.h file but unable to figure out anything.
The code is as follows:
1
vote
2
answers
18k
views
pset 3 GDB: "no executable file specified"
I've been working my way through CS50 and I'm having a problem I hope someone can help me with. I can't get GDB to function at all, and I think it might be a problem with startup - when I type "gdb" ...
0
votes
1
answer
479
views
helpers.c not exist
When I used check50, show this bug... I understand that "helpers.c" is not compile, but in MakeFile all looks good. I'm in the step of binary search and sort.
What can I do to find the error?
...
0
votes
1
answer
182
views
pset3 find - gdb with generate as pipe
I am on binary search in pset3 find. As noted here, I get an crash when I try to run it through a pipe to generate with more than 580 numbers to generate with seed of 50. So command (note that it is ...
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....
0
votes
1
answer
260
views
result of search function ignored by find.c
for negative results ,its O.K.
0 , 1 , 2 , 3 , 4 , 4 , 5 , 6 , 7 , 7 , 8 , 9 , 11 , 22 , 33 , 66 , 78 , 88 , 455 , 999 ,
lower =0 ,upper = 19 ,mid = 9 ,values[mid] = 7
lower =10 ,upper = 19 ,mid = ...
0
votes
2
answers
302
views
find.c Compiling in my machine but not while doing check50
My code for find.c is working fine. I checked with other examples other than on the problem set. I implemented binary search using recursion and changed the search function to include beginning and ...
0
votes
2
answers
3k
views
Pset 3 - Find and Helper.C
Question about find and helpers.c. When I run check50 on my code, I get the following error below:
:( doesn't find 42 in {39,40,41}
\ expected an exit code of 1, not 0
:( doesn't find 42 in {39,...
0
votes
0
answers
135
views
I can't get search to work when value == value[n]
I'm trying to implement a recursive binary search in helpers.c. When checking my code with check50, everything works except:
:( finds 42 in {40,41,42}
:( finds 42 in {39,40,41,42}
So obviously ...
0
votes
2
answers
170
views
Selection sort does not sort the unsorted portion once no swapping position is reached?
I've been struggling with this bug for almost 2 days, but so far no success.
If anyone could point out what is wrong with my code, I would appreciate it very much.
Using my own random numbers (100, ...
2
votes
1
answer
170
views
Pset3 search: can't seem to find the last number
Everything else in check50 works, but my program can't find 42 in {40, 41, 42} and {39, 40, 41, 42}.
I don't think it's sort's fault, and I've implemented search in the correct way (I think, at ...
4
votes
1
answer
532
views
pset3 find INT_MAX
In find.c, there's a conditional that references a constant called "INT_MAX". I looked through all the pset files and couldn't find any reference to this constant. What is it, what does it represent,...
2
votes
1
answer
1k
views
How does find.c know to use functions from helpers.c?
I've been beating my head trying to understand the second assignment for pset 3. It states in part:
Notice that find.c calls search, a function declared in helpers.h.
Unfortunately, we forgot to ...
0
votes
1
answer
154
views
pset3 find.c corner case
I made a for loop for searching and sorting in the header file. Both loops start off like this:
for (int i = 0; i < n ; i++)
find.c compiles fine for me but when I put the needle at the end of ...
1
vote
1
answer
380
views
How do I check pset3 find?
I think I've finished find.c, but I'm not quite sure how to check it. For example, one of the things it must do is find 42 in {42, 43, 44}, so how do I enter this into the terminal window? Do I use ...
3
votes
2
answers
691
views
My pset3 find code completes all tasks using check50, but gradebook says it's wrong
I can't seem to figure out why the CS50x gradebook says that my find code is wrong but when I check the exact same code using check50, I get all smileys.
I did everything as per instructed. I ...
1
vote
1
answer
215
views
Segmentation fault core dump with find and helpers.c
I have been working on find.c for the last three days, without success. When I run check50, 50% of the time it compiles helpers.c but then does not find 42 as it is supposed to. The other 50% of the ...
0
votes
1
answer
100
views
Values found aren't the ones submitted?
I'm working on pset3, and I think I've finished helpers.c. It sorts correctly, and I can't find any mistakes, but it does something really weird. If I enter the values 1, 2, 3, 4, 5 into find.c as hay,...
1
vote
1
answer
7k
views
What does "error in backend: IO failure on output stream" signify?
I altered the code in helpers.c in such a way that when the difference between the find value and the "haystack" value equals zero the program returns true.
However find will no longer compile and ...
0
votes
1
answer
435
views
Pset 3 - find.c is not working
I have compiled find.c, generate.c and helpers.c. When I compile make all, I get the following error message:
jharvard@appliance (~/Dropbox/pset3/find): make all
clang -ggdb3 -O0 -std=c99 -Wall -...
1
vote
1
answer
4k
views
How to Fix "control may reach end of non-void function" and "No such file or directory" Errors?
When I compile find, I get this error message
error: control may reach end of non-void function
When I then try to run the program
./find 14
I get this error message
bash: ./find: No such file ...
2
votes
2
answers
516
views
Find.c does not find the value that I put in haystack
For pset3, I have to download pset3.zi and unzip it.
I followed all the steps in the instruction. However, when I get to the program find.c, there's a problem.
The program seems like not working ...
0
votes
2
answers
647
views
helpers.c: EOF not working
I have made find.c and coded binary search in helpers.c, so when I run find like
./find 42
and start entering sorted values like
haystack[0] = 42
haystack[1] = 43
haystack[2] = 44
haystack[3] = ...
2
votes
3
answers
357
views
pset3 FIND: Strange clang error whenever I compile code
I'm coding binary search in helpers.c currently, but I receive a strange clang error every time I try to compile code. I'm absolutely sure my code is logically and syntaxily correct. Where am I going ...