Explain the various operations of the list ADT with examples
1 Answer

Abstract Data type (ADT)

Abstract Data type (ADT) is a type (or class) for objects whose behavior is defined by a set of values and a set of operations.

There are three ADTs namely List ADT, Stack ADT, and Queue ADT.

List ADT

  • The data is generally stored in a key sequence in a list that has a head structure consisting of count, pointers, and address of compare the function needed to compare the data in the list.

enter image description here

  • The data node contains the pointer to a data structure and a a a self-referential pointer that points to the next node in the list.

//List ADT Type Definitions

typedef struct node


void *DataPtr;

struct node *link;

} Node;

typedef struct


int count;

Node *pos;

Node *head;

Node *rear;

int (*compare) (void *argument1, void *argument2)


A list contains elements of the same type arranged in sequential
order and following operations can be performed on the list.

  • get() – Return an element from the list at any given position.
  • insert() – Insert an element at any position of the list.
  • remove() – Remove the first occurrence of any element from a non-empty list.
  • removeAt() – Remove the element at a specified location from a non-empty list.
  • replace() – Replace an element at any position with another element.
  • size() – Return the number of elements in the list.
  • isEmpty() – Return true if the list is empty, otherwise return false.
  • isFull() – Return true if the list is full, otherwise return false.
Please log in to add an answer.