What Is Inverted List in Data Structure?


Angela Bailey

In data structures, an inverted list is a data structure used to efficiently store and retrieve information in an index. It is commonly used in information retrieval systems, search engines, and databases.

What Is an Inverted List?

An inverted list is a mapping between unique terms or keywords and the documents or records that contain those terms. It represents a forward index in a reversed manner. Instead of storing the terms with references to the documents they appear in, an inverted list stores the documents with references to the terms they contain.

Benefits of Inverted Lists:

  • Efficient Retrieval: Inverted lists allow for fast retrieval of documents containing specific terms. They provide an efficient way to answer queries by quickly identifying relevant documents.
  • Reduced Storage Space: By storing only the documents and their associated terms, inverted lists can save significant storage space compared to alternative methods.
  • Flexibility: Inverted lists can handle large amounts of data and support dynamic updates. They can easily be updated when new documents are added or removed.

Components of an Inverted List:

An inverted list consists of two main components:

1. Term Dictionary:

The term dictionary contains all the unique terms present in the indexed documents. Each term is associated with a posting list that contains references to the documents where that term appears.

2. Posting Lists:

A posting list contains references (pointers or document IDs) to the documents that contain a specific term. Each entry in a posting list typically includes additional information such as term frequency, positions, or other statistics related to the occurrence of the term within each document.

Inverted List Example:

Let’s consider a simple example to illustrate how an inverted list works. Suppose we have three documents:

  1. Document 1: “The quick brown fox”
  2. Document 2: “Jumped over the lazy dog”
  3. Document 3: “The quick dog”

The inverted list for this example would look like:


Term Posting List
The [1, 3]
quick [1, 3]
brown [1]
fox [1]

In this example, the term “The” appears in documents with IDs [1,3], and the term “quick” appears in documents with IDs [1,3]. The posting lists contain references to the documents where each term appears.

Inverted List Operations:


To add a new document to an inverted list, the document is tokenized (split into terms) and each term is added to the term dictionary along with a reference to the document in its posting list.


To retrieve documents for a specific query or term, the inverted list is searched for that term in the term dictionary. The corresponding posting list is then returned, providing the necessary references to the documents.


Inverted lists are a fundamental component of many information retrieval systems. They provide an efficient way to organize and retrieve information based on specific terms or keywords. By using inverted lists, search engines and databases can quickly identify relevant documents, improving the overall performance of these systems.

Remember, understanding inverted lists is crucial when working with search engines or designing efficient information retrieval systems.

Discord Server - Web Server - Private Server - DNS Server - Object-Oriented Programming - Scripting - Data Types - Data Structures

Privacy Policy