Skip to content

shajalahamedcse/gIntersect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gIntersect

Only prints those words that are both in [File A] and [File B]

usage : intersect [File A] [File B]
Prints out the lines that are both in [File A] and [File B]

Example

$ cat FileA.txt
hello
$ cat FileB.txt
hello
world
$ gIntersect FileA.txt FileB.txt
world

Performance

$ time grep -w FileA.txt FileB.txt
real    0m0.028s
user    0m0.003s
sys     0m0.000s

$ time ./main FileA.txt FileB.txt
real    0m0.004s
user    0m0.001s
sys     0m0.004s

Memory

gIntersect reads the contents of [FileA.txt] into (hashmap) memory then compares it with [FileB.txt] . So performance will deteriorate for very large [FileA.txt] file.

About

gIntersect does intersection operation between two file and then give the output. What is intersection ? Remember Set theory.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages