Lists


A list is a sequence of zero or more data items, with the total number of items being the length of the list.

It can grow and shrink on demand and items can be accessed, inserted or deleted at any position.

lists


Types of Lists

Lists in C

struct elem {
  struct elem *next;
  int val;
};
struct elem
  struct elem *next;
  struct elem *head;
  int val;
};
struct elem *head = NULL;
struct elem *tail = NULL;

Applications

  • Often used to implement other data structures e.g. queues and stacks
  • Used for mathematical vectors and matrices