Click here to Skip to main content
14,978,657 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: Bayesian stats & a Q Pin
raddevus17-Dec-20 2:37
mvaraddevus17-Dec-20 2:37 
GeneralRe: Bayesian stats & a Q Pin
Amarnath S17-Dec-20 3:34
professionalAmarnath S17-Dec-20 3:34 
GeneralRe: Bayesian stats & a Q Pin
Andreas Mertens17-Dec-20 3:33
professionalAndreas Mertens17-Dec-20 3:33 
GeneralRe: Bayesian stats & a Q Pin
raddevus17-Dec-20 4:22
mvaraddevus17-Dec-20 4:22 
GeneralRe: Bayesian stats & a Q Pin
PhilipOakley17-Dec-20 4:24
professionalPhilipOakley17-Dec-20 4:24 
GeneralThought of the Day Pin
OriginalGriff16-Dec-20 4:57
mveOriginalGriff16-Dec-20 4:57 
GeneralRe: Thought of the Day Pin
W Balboos, GHB16-Dec-20 5:24
mveW Balboos, GHB16-Dec-20 5:24 
GeneralI'm clever this morning Pin
honey the codewitch16-Dec-20 4:47
mvahoney the codewitch16-Dec-20 4:47 
This isn't even really enough for a tip but if you ever can't implement a real hashtable for reasons there's a pretty decent fake you can do for strings:

Store sz strings prepended by a size_t length (which includes trailing zero char) contiguously [len][string][len][string][len][string], like that

when you go to check for a match, start at the beginning.

get the size_t len from the current position
see if it matches your passed in string's length (don't forget to account for the trailing zero). if it doesn't, increment the current table pointer by len and continue

if it does, then in a loop check each character to see if they match. once you find one that doesn't match, you can increment the current table pointer by the remaining characters (computed from len and your current position)

this way you early out on non matches and you've got a remedial hash on top of that (the count)

all of that and you don't require an actual hashtable, and it's not bad in terms of space/time from my tests (currently on JSON fields in a document)
Real programmers use butterflies

GeneralRe: I'm clever this morning Pin
PIEBALDconsult16-Dec-20 5:24
professionalPIEBALDconsult16-Dec-20 5:24 
GeneralRe: I'm clever this morning Pin
Rick York16-Dec-20 5:30
mveRick York16-Dec-20 5:30 
GeneralRe: I'm clever this morning Pin
trønderen16-Dec-20 5:57
Membertrønderen16-Dec-20 5:57 
GeneralRe: I'm clever this morning Pin
Jörgen Andersson16-Dec-20 6:36
professionalJörgen Andersson16-Dec-20 6:36 
GeneralPythagorean Theorem Day today Pin
Amarnath S16-Dec-20 4:32
professionalAmarnath S16-Dec-20 4:32 
GeneralRe: Pythagorean Theorem Day today Pin
W Balboos, GHB16-Dec-20 4:47
mveW Balboos, GHB16-Dec-20 4:47 
GeneralRe: Pythagorean Theorem Day today Pin
CodeWraith16-Dec-20 6:41
MemberCodeWraith16-Dec-20 6:41 
GeneralRe: Pythagorean Theorem Day today Pin
Slacker00716-Dec-20 8:00
professionalSlacker00716-Dec-20 8:00 
GeneralRe: Pythagorean Theorem Day today Pin
CodeWraith16-Dec-20 8:09
MemberCodeWraith16-Dec-20 8:09 
GeneralRe: Pythagorean Theorem Day today Pin
trønderen16-Dec-20 14:57
Membertrønderen16-Dec-20 14:57 
GeneralRe: Pythagorean Theorem Day today Pin
DRHuff16-Dec-20 7:26
MemberDRHuff16-Dec-20 7:26 
GeneralRe: Pythagorean Theorem Day today Pin
BabyYoda16-Dec-20 8:25
MemberBabyYoda16-Dec-20 8:25 
GeneralRe: Pythagorean Theorem Day today Pin
jeron116-Dec-20 8:40
Memberjeron116-Dec-20 8:40 
GeneralRe: Pythagorean Theorem Day today Pin
  Forogar  16-Dec-20 9:24
professional  Forogar  16-Dec-20 9:24 
GeneralRe: Pythagorean Theorem Day today Pin
Rich Leyshon16-Dec-20 21:54
MemberRich Leyshon16-Dec-20 21:54 
GeneralCame Across This Pin
W Balboos, GHB16-Dec-20 3:55
mveW Balboos, GHB16-Dec-20 3:55 
GeneralRe: Came Across This Pin
Rick York16-Dec-20 5:34
mveRick York16-Dec-20 5:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.