I don't suppose any programmers are willing to comb through a few hundred lines of C code and tell me why my program...

I don't suppose any programmers are willing to comb through a few hundred lines of C code and tell me why my program isn't properly counting collisions in a hashtable that's being probed quadratically?

Mmm, quadratical probing...

idk
post it at least

programmer here, post it bitch

what do you mean isn't counting collisions correctly? just index into it with your hash and see if its occupied or null

This isn't Sup Forums, fa/g/g/ot.

I just copied and pasted the header file that I've been using, so idk if it'll work this way, but the way it is now, I'm getting around 400,000 collisions when I'm supposed to get around 1,300,000...

pastebin/PgAKiqb2

I think the main problem is in my search function, but I haven't been able to fix it, so who knows.

are you saying line 97 isnt printing what you're expecting?

yeah

It looks like there was a #endif at the end of the header that I missed.

Not sure what that even does...

Why do you think its your search function?
In main, it looks like you are only inserting elements then checking the # of collisions. I dont see you calling search in insert, only collisions++ on a collision.

Shit, I didn't even realize that.

I just assumed it was search or delete because they were the ones giving me trouble in other testcases

The insert function looks correct to me, are you sure that the value you are expecting is correct?

Post SRC and Contact info, and i will take a look at it if you still need someone too.

It ends the if conditional statement

this is why i never left qbasic

Yeah, the rest of my class got it to work with those numbers.

I think I might have not put in all the situations that they're considering a collision.

I know for the search and delete functions it's not a collision of the value is UNUSED (if it's unused then the function stops there) or if it's the key value, and it is a collision if the value is DIRTY or a number besides the key.

expand and insert descriptions weren't as specific though.

So edgy...

>hashtable
>probed in n^2

um

Idk the only thing that i can see that might be wrong is that you aren't probing correctly on line 352 (idk maybe you are i forgot exactly how quadratic probing works) or you aren't expanding the table the way that you think that you are.

I think I can figure it out now, thanks guys.

so, in your expandhashtable function you are putting the elements in different places when you modulo newcap instead of doing the modulo on h->capacity. Is that what you are meaning to do?

no, newCap is holding the length of the longer array that the numbers are going into, h->capacity still has the length of the old array at that point, I switch it afterwards before freeing the old array.