Skip to main content
3 votes
Accepted

Pset 8 search and configure functions

According to the spec [emphasis added]: Complete the implementation of /search in such a way that it outputs a JSON array of objects, each of which represents a row from places that somehow matches ...
DinoCoderSaurus's user avatar
2 votes
Accepted

pset3 search: expected an exit code of 0 not 1

It's because you pass the address of midpoint as the third parameter of comparer(), instead of values[]. Try int result = comparer(midpoint, value, values); instead of int result = comparer(...
ChrisG's user avatar
  • 7,396
2 votes
Accepted

2017 pset8 mashup: Slow search - how to improve search performance?

1: The more columns you are searching the more results you return. For example as you start to type the word "Boston" the search query takes 'B' and looks for every word in the column with a 'B' in it....
Shauny's user avatar
  • 96
1 vote

Big blunder while submitting CS50W Project 0

Let's try to sort this out. It sounds like you created the new branch from your final project branch, which would have copied those files to it. You should be able to clone the web50/projects/2020/x/...
curiouskiwi's user avatar
  • 18.7k
1 vote

Header links won't align to the right (P2)

I'm not familiar with align-items (and, like a lot of CSS, it makes my head itch). And the Examples on the MDN doc page don't show any difference among 'center', 'right' and 'left'. I do know that ...
DinoCoderSaurus's user avatar
1 vote

pset8 2018 mashup search

I'd change that to simply $.getJSON("/search", ....) with no reference to Flask.
curiouskiwi's user avatar
  • 18.7k
1 vote
Accepted

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

Both search and sort have problems. First, sort isn't complete. It only makes one pass through the list, so it will only bubble sort the largest value to the last position. I suggest a review of the ...
Cliff B's user avatar
  • 69.1k
1 vote

PSET 3, there is nothing happening

Your do..while loop really should be a regular while loop, but it would blow up only if your array to search was empty (then you're accessing values[-1] within the loop). Your condition is wrong. ...
Blauelf's user avatar
  • 21k
1 vote
Accepted

pset8 search function not working like supposed to

Here's a way to see what the problem is using command line python: Python 3.4.3 (default, Nov 17 2016, 01:08:31) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more ...
DinoCoderSaurus's user avatar
1 vote
Accepted

cs50 pset3 binary search

You are getting this error message because, apparently the compiler couldn't find the main function in your program. Most probably you are compiling your code like this: make helpers the compiler ...
Abdullah Emad's user avatar
1 vote

Binary Search for helpers.c

Your code will keep on running as long as n>0, and since n is static, it keeps on going even if the value is not in the array. A better way would be to keep track of how many times you've looked ...
ronga's user avatar
  • 1,415
1 vote
Accepted

Binary Search for helpers.c

"killed by server" usually indicates an infinite loop, which is exactly what is happening here. Take a good look at your search function and consider what happens when a number is not in the list. ...
Cliff B's user avatar
  • 69.1k
1 vote

pset3: linear search (strange behaviour)

I just had to recompile find.c. Problem solved.
Petar Petrov's user avatar
1 vote
Accepted

pset3: linear search problem

if you have code like: if(...) return true ..... else(...) return false this is an error, the compiler needs to know what value is to be returned, but if you have a condition if-else like ...
MARS's user avatar
  • 5,179
1 vote
Accepted

pset 3 Binary search

First - think about what a segmentation fault is. It happens when you try to access memory that doesn't belong to you. https://stackoverflow.com/questions/2346806/what-is-a-segmentation-fault Try ...
Sid Panjwani's user avatar
1 vote
Accepted

Check50 is claiming that it's recieving an exit code of 0 rather than 1 (different scenario)

This code will never find anything unless value == midpoint. On each pass through the loop, it updates the min or the max, but it never updates midpoint. Since midpoint never changes, the loop will ...
Cliff B's user avatar
  • 69.1k
1 vote
Accepted

Why am I generating the following errors with this code if it says it's compiled correctly?

One of the lessons of this pset is how to build an executable from multiple source files using a makefile. The link error is happening because you are trying to make helpers. Because there are no ...
Cliff B's user avatar
  • 69.1k
1 vote

Cannot find the needle 127 in the haystack of 1000 random numbers using linear search . Any ideas on what I may have done wrong?

Asked and answered in comments. Except for a minor flaw, the search code appears correct. It should be finding 127. More likely, there's a problem with the code that loads the numbers in the array. ...
Cliff B's user avatar
  • 69.1k
1 vote
Accepted

pset3 helpers.c (help)

You are comparing to element values[(n+1)/2], but your recursive calls look like you meant values[n/2] instead, which makes a lot more sense, as n/2 is always the middle element's index, or the higher ...
Blauelf's user avatar
  • 21k
1 vote
Accepted

Query for postal code as well as place and admin name in Search route in application.py mashup

Conventional wisdom says that places.postal_code should be a TEXT column in the database. It eliminates all those pesky conversions. It preserves leading 0's in US postal codes, and it is more ...
DinoCoderSaurus's user avatar
1 vote
Accepted

pset3 Search - 2 equal ints not triggering if

Better not use n inside the loop, but create another variable for the middle index (so you don't have to recalculate it, I'll call that middle for this post). Loop condition then should be something ...
Blauelf's user avatar
  • 21k
1 vote

working with pset3

Unless the code is searching for a 0, it will never return true. You've created something called a shadow variable value inside the for loop and set it to 0, so it will always search for 0. A shadow ...
Cliff B's user avatar
  • 69.1k
1 vote

Recursive binary function returns error: control reaches end of non-void function

Your binarysearch function follows this logic: if (something) { if (something_else) { else { /* ... */ } /* **ERR:NOTHING_IS_RETURNED** */ // Here you must add a ...
kluvin's user avatar
  • 1,223
1 vote

Pset8 search add fulltext error

Fulltext index is only supported on columns that are either of type varchar, text, or char, and some others you likely won't use. latitude and longitude are both of type decimal. See this page, quote ...
kluvin's user avatar
  • 1,223
1 vote
Accepted

pset8 search: FULLTEXT error on including longitude and latitude

Did you set up a FULLTEXT index for the exact columns you want to include yet? If you have already set up a FULLTEXT index with just postal_code, place_name, admin_name1, admin_code1 then you might ...
hotwebmatter's user avatar
  • 3,050
1 vote
Accepted

pset8 search: Which column represents State?

admin_name1 is the state's fullname, like in "Alaska" admin_code1 is the abbreviation, like "AK" for Alaska. Which one you'll use will depend if you're working with the fullname or the abbreviation
Yuri Laguardia's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible