algorithm - Search a 16 GB file on disk with 8 GB RAM -


i asked following interview question of late, "you have 8 gb ram , 16 gb file " how perform search on file ?

then asked type of file ,what language ?, said format,any language increase confusion !

after while asked me assume text file !

answer per knowledge shared interviewer : edit : use buffered streams custom size , sort data on buffer apply binary search on buffered streams (if it's relevant) !

i believe interviewer not convinced !!

i understand question vague !

i want know point missed ask interviewer , probable solution ? guidance or advice on appreciated !

thanks !

i solution search first in first half of file linear search; if search fails perform same action on second half of file.

your solution wrong because didn't take account memory limit : how buffer , sort content if can't load in memory (you can have explain how)? same applies binary search: can't use standard algorithm, have customize it.

moreover, if you're searching substring in text file solution inappropriate (what sort?)


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -