A difference between BSBI and SPIMI is that SPIMI adds a posting directly
to its postings list (line 10). Instead of first collecting all termID–docID
pairs and then sorting them(aswe did in BSBI), each postings list is dynamic
(i.e., its size is adjusted as it grows) and it is immediately available to collect
postings. This has two advantages: It is faster because there is no sorting
required, and it saves memory because we keep track of the term a postings