Questions tagged [linear-search]

The tag has no usage guidance.

6 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0 votes
1 answer
57 views

PSET 3 Linear Search Error

Keep getting the error of "control may reach end of non-void function" This is for the linear search, can someone please give me some help/tips into getting this error to go away? This is my code: ...
Faith Zellman's user avatar
0 votes
1 answer
801 views

pset3 helpers.c linear search confusion

bool search(int value, int values[], int n) // TODO: implement a searching algorithm if (n >= 0) { for (int i = 0; i < n; i++) { if (values[i] == value) ...
hagan10's user avatar
0 votes
0 answers
103 views

Why isn't my linear search working correctly?

I cannot get my linear search programm to work and it seems to be a problem with the return of false if the needle is not found. My coding for the search is bool search(int value, int values[], int n)...
salim's user avatar
  • 1
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++) ...
mathmagician's user avatar
0 votes
1 answer
812 views

linear search compilation error

I've updated search function in helpers.c with code below. I had to remove reference to helpers.h since that was causing even more errors. #include <cs50.h> // #include "helpers.h&...
Dauren Z's user avatar
0 votes
0 answers
114 views

what's wrong with my linear search?

I don't get this. I did a whole lot of debugging with gdb, and somehow move returns false automatically just after this simple search for the tile. int p=0,q=0; for(i=0;i<d ;i++) { for(j=0;j<...
Amrita's user avatar
  • 50