Skip to main content

Questions tagged [find]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
22 views

Find's sort: instructions vs code: O(n) or O

The docs for find's sort say, The running time of your implementation must be in O(n), where n is the array’s size. Yes, linear! Keep in mind that 65,536 is a constant. However, the code that we'...
Evan Carroll's user avatar
1 vote
1 answer
11 views

Minor typo in cs50ap find docs?

From the docs on find If you do plan on using additional functions in helpers.c, be sure to include the function prototypes in helpers.c. I think that last helpers.c, should be helpers.h?
Evan Carroll's user avatar
0 votes
1 answer
147 views

PSET3 - Find (More) - Debugging and bubble sort issues

Pset 3 (2017): create program, find, that finds a number in an array of generated numbers. We need to implement functions for both sorting and searching the array using helper files. Since a binary ...
Kam Clark's user avatar
0 votes
1 answer
60 views

Pset3 2017 less bubble sort

I decided to do pset 3 from 2017 as extra practice, but ran into an issue with bubble sort. More specifically, when I run check50 on it I get: :( sorts {5,4,3,2,1} expected "1", not "\n5\n5\n5\n5\n5.....
user avatar
0 votes
1 answer
51 views

Check50 for find-less in ps3 shows me a './sort' error

I implemented the helpers for sort and search. Using basic implementations of quicksort and binarysearch. When I ran check50 cs50/2017/x/find/less there was a weird error for the sorting part: :) ...
Chris's user avatar
  • 103
0 votes
1 answer
35 views

Check50 for find less tries to compile sort.c

the find and generate functions both compile and produce correct output. But when it comes to check50, I get this message: I go and check the URL provided that shows which commands were being run ...
Mike's user avatar
  • 3
0 votes
1 answer
57 views

EOF NOT WORKING IN PSET 3 LESS FIND

CURRENTLY I AM TRYING TO SOLVE THE PSET3 LESS FIND BELOW IS MY CODE.PROBLEM IS THAT WHEN I WANT TO USE CTRL-D FUNCTION TO EXECUTE EOF FUNCTION IT DID NOT WORK.I THINK CODE ENTER IN A INFINITE LOOP BUT ...
mjahanzaib6's user avatar
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
1 answer
64 views

pset3 find more comfortable - sort works in debugger but fails check50. search works

I am sorting and passing the sorted Array to SEARCH. sort is working in debugger but not in check50 :) helpers.c exists. :) helpers.c compiles. :( sorts {5,4,3,2,1} expected "2", not "\n" :( sorts {5,...
virsam's user avatar
  • 3
0 votes
1 answer
81 views

Pset3 Find - More confortable (counting sort algorithm)

/** * helpers.c * * Helper functions definitions for Problem Set 3. */ #include <cs50.h> #include <stdio.h> #include "helpers.h" /** * Returns true if value is in array of n values,...
Rafael Áquila's user avatar
0 votes
1 answer
56 views

CS50 pset3 find - Error: expected identifier, unused parameter

I am working at pset3 find - helpers.h. The file compiles but I the command line is yelling at me: I was searching the web for hours but cannot find the reason for these errors. Help is much ...
AlexL's user avatar
  • 5
0 votes
1 answer
55 views

pset3 find code works, despite 'sort' failing

I'm very confused! I have spent many (MANY) hours working through this pset. I've gotten to the point where my code passes all check50 requirements for 'find', but it's failing the 'sort' ...
Alex's user avatar
  • 7
0 votes
1 answer
299 views

pset3 help with find, bubble-sort and search

I've been struggling for over a week with this and can't figure out how to get my program to pass check50. I'm getting very interesting mixed results from check50: :) helpers.c exists. :) helpers.c ...
Alex's user avatar
  • 7
0 votes
1 answer
44 views

pset3 keeps returning 1 even when it should return 0

bool search(int value, int values[], int n) { // TODO: implement a searching algorithm if (value < 0) return false; int s = 0; int e = n - 1; int m = ((s + e) / 2); while (s <= e) { ...
AMtman's user avatar
  • 1
0 votes
1 answer
22 views

pset3 Find: Getting compilation error when running "make find"

/** * find.c * * Computer Science 50 * Problem Set 3 * * Prompts user for as many as MAX values until EOF is reached, * then proceeds to search that "haystack" of values for given needle. * * ...
Abhimanyu's user avatar
0 votes
1 answer
124 views

week 3 find problem

I thought I finally made the program find work, but it still won't function when I test it with help50. I have looked at the code the whole day and just cannot seem to figure out what to do to solve ...
Jamie Olsen's user avatar
0 votes
1 answer
65 views

CS50 Pset3/less check errors

Hi I am very frustrated since 5 days that I cannot pass check50 that keeps giving me error as: Does anyone have any suggestions? :) helpers.c exists. :) helpers.c compiles. :( sorts {5,4,3,2,1} ...
NTM's user avatar
  • 1
0 votes
1 answer
31 views

Error with fifteen?

I am taking the Harvard ap cs5o class, and I just started the pset3's fifteen. I followed the directions to get the skeleton code from here: Problem scope After reading and following along I tried ...
Massimo's user avatar
0 votes
0 answers
137 views

Pset 3 !! Find (less) !! Need help, please

this is my code (find.c) : #include "helpers.h" const int HAY_MAX = 65536; int main(int argc, char * argv[ ]) { if (argc != 2) { printf("Usage: %s need\n", argv[0]); return ...
Kris Le's user avatar
0 votes
1 answer
52 views

find is not compiling

/** * helpers.c * * Helper functions for Problem Set 3. */ #include <cs50.h> #include<stdio.h> #include "helpers.h" /** * Returns true if value is in array of ...
Arivezhil Namasivayam's user avatar
0 votes
1 answer
40 views

Pset3 Find: Odd bug in binary search, some times works, sometimes I am stuck in a loop

I have a bug in this binary search code that I can't get to the bottom of. Sometimes the code works, and sometimes it just goes into an endless loop. I think I must be close, but any tips where I am ...
Jamie Green'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
625 views

CS50 Helpers.C Find Less, No Idea What's Going On

Final Code: /** * helpers.c * * Helper functions for Problem Set 3. */ #include <cs50.h> #include "helpers.h" /** * Returns true if value is in array of n values, else false. */ bool ...
R_C's user avatar
  • 115
0 votes
1 answer
43 views

PSet3 Find (more) said to assume that array's numbers are non-negative

When I ran the check50, all the values were green except: :( sorts {10,-6,4,8,7,-3} expected "-6", not "\n4\n7\n8\n10\n..." The pset said to assume that the array's numbers are non-negative. Is ...
Abenezer Mamo's user avatar
0 votes
1 answer
35 views

pset3 code not finding any numbers when in helpers.c

// TODO: implement a searching algorithm if(n <= 0) { return false; } int end = n; int start = 0; int middle = (start + end)/2; int found = 0; while(found == 0) { if(value == values[...
Declan Lim's user avatar
0 votes
1 answer
367 views

pset3/find check50 frown helpers.c compiles. expected exit code 0, not 1

When checking my find program with check50 I get a :( frown at the second check, which is: helpers.c compiles. expected exit code 0, not 1 The log file gives me additional info: running clang -...
gunjx's user avatar
  • 3
0 votes
1 answer
281 views

Need Help In Merge Sort

From last couple of days I am trying to write code for Merge sort. I have completed Week3 lectures and trying to solve pset3. Need some help in my code for merge sort. The code seems to work fine with ...
Ankush Agrawal's user avatar
0 votes
1 answer
145 views

pset3 bubble sort

pls could anyone tell me where have i made the mistake?...as i have tried to find it myself but couldn't find it. void sort(int values[], int n) { int min=0,max=0; do{ //to compare ...
shaistha's user avatar
  • 117
0 votes
1 answer
250 views

How to debug find.c?

I'm just working on find.c and helpers.c. My sort is not completely working yet and I'm trying to debug the program but the debugger is not working. Is there anything special I have to do since find....
Christopher W'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
24 views

I realize this code is not the nices, but wIll this code work? The code is for pset3 selection sort?

void search(int array[] , int length) { int min = 0; while (min <= length-1) { int index = min+1; if array[min] >= array[index] { min = index; ...
Tom55555's user avatar
0 votes
1 answer
27 views

pset3 - find are compiling but wrong result?

solving find more comfortable and when I excute ./generate 1000 50 | ./find 127 it gives me output like this : haystack[0] = haystack[1] = haystack[2] = haystack[3] = haystack[4] = . . . haystack[1000]...
Marwan Bshara's user avatar
0 votes
1 answer
45 views

For pset3 find binary search will this code work? If not is it close?

bool binary_search (int target, int array[]) { int end = length-1; int start = 0; // 7 0 14 // 11 8 14 // 9 10 + ...
Tom55555's user avatar
0 votes
1 answer
170 views

pset3 find- check50 Why doesn't find returns frowning face

I am not sure where I have gone wrong with helpers.c. I passed all check50 tests except for 2 under "doesn't find". My code is below: code removed What check50 returns is as follow: :) helpers.c ...
aman0016's user avatar
0 votes
1 answer
67 views

pset3, find (more comfortable), use of undeclared identifier 'MAX' error

I am trying to initialize an array for counting sort in helpers.c int count[MAX] = {0}; If i try to compile by typing "make all", i get an error message helpers.c:52:15: error: use of undeclared ...
Nick F's user avatar
  • 3
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
98 views

Pset3 counting sort - segmentation fault error

I am trying to implement a counting sort function for Pset3 find (more comfortable), and have written up the code below: void csort(int values[], int n) { int limit = 5; // CHANGE LIMIT HERE ...
yeungparkhay's user avatar
0 votes
1 answer
94 views

PSet 3: binary search help

My program is almost working, I just cannot figure out why my binary search is not working. I am pretty sure that the sorting is fine. Any help would be appreciated. check50: :) helpers.c exists :) ...
Richard Le's user avatar
0 votes
1 answer
30 views

Find.c is finding numbers that aren't in the list

I got almost all of my code to work for find, it passes all of the check50s except 1, it finds 42 in {39, 40, 41, 43} My code so far is: /** * helpers.c * * Helper functions for Problem Set 3. */...
Joel Banks's user avatar
0 votes
2 answers
44 views

./generate 1000 | ./find 42 failed, get_int() got nothing but program still worked

If I use ./generate 10, I can successfully printf a random list, and if I use ./find 42, there successfully comes prompts to a ask me input numbers. However, if I use ./generate 10 | ./find 42, the ...
Huang Liang Hsiung's user avatar
1 vote
1 answer
62 views

Update for the IDE stopped programs from getting compiled [duplicate]

I updated the CS50 IDE and was not able to make 'find' in pset 3. It was working before I updated the IDE. The error it gives is: $ make all clang -ggdb3 -O0 -std=c11 -Wall -Werror -o find find.c ...
Amol Venkataraman's user avatar
0 votes
1 answer
50 views

Check 50 for find

I have gotten most of my code to work for the search and sort, but I still have a few issues. One is i my for loop, I have it set to less than 100, though I need to make it less than log n, but I ...
Joel Banks's user avatar
0 votes
1 answer
34 views

Binary search recursing issue

I've been working on a binary search of pset3 find, and I'm having an issue when I call the function again recursively. I believe that I know what the issue is, I'm just not sure how to fix it. When I ...
Joel Banks'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
1 answer
255 views

How does one print out all existing integers in an int array?

The code below generates the following error: format specifies type 'int' but the argument has type 'int *' [-Werror,-Wformat] printf("%i", array); include include int main(void) { int ...
Drusk's user avatar
  • 3
0 votes
1 answer
80 views

Puzzled by Pset3 - find less confortable- sorting output

I just checked my code for Pset3 finds less confortable and it works but I am puzzled by some of the printf I put to debug my code. I put this just at the end of my sorting function: printf("%i %...
Guillaume_slize's user avatar
0 votes
2 answers
114 views

Help finding segmentation fault

In my code, I get a segmentation fault some, but not all of the times that I run it. Sometimes, it sorts the code and finds the needle, sometimes it doesn't sort correctly and ends with a segmentation ...
Joel Banks's user avatar
0 votes
1 answer
41 views

Bubble sort code works, but does not stop

I fixed my bubble sort code, and it correctly sorts the numbers, but it does not stop when it should. My code is: #include <cs50.h> #include <stdio.h> #include <stdlib.h> //#...
Joel Banks's user avatar
0 votes
1 answer
10k views

'int' but the argument has type 'int * problem with sort in helpers.c

I am having a problem with returning the sorted value in the function sorted. I know it has something too do with fun pointers. On a side note, how is a function suppost return something if it's ...
Nova's user avatar
  • 7
0 votes
1 answer
55 views

Help fixing bubble sort

I've been working on implementing a bubble sort, and I can get it to swap one time through the list, but I can't get it to run more than once, and I'm not sure how to implement it. I also know that ...
Joel Banks's user avatar