# What Are the Notations in Data Structure?

//

Heather Bennett

Data structures are an essential aspect of computer science and programming. They provide a way to organize and store data efficiently, allowing for faster access and manipulation.

When working with data structures, it’s important to understand the various notations used to represent them. These notations help us visualize the structure and operations performed on the data.

## 1. Array Notation:

An array is a collection of elements stored in contiguous memory locations. It can be represented using square brackets and indices:

``` int arr[5]; ```

This creates an integer array named “arr” with five elements.

## 2. Linked List Notation:

A linked list is a dynamic data structure composed of nodes, where each node contains a value and a reference to the next node. It can be represented using arrow notation:

``` struct Node { int data; struct Node* next;} *head; ```

This creates a linked list with each node containing an integer value and a pointer to the next node.

## 3. Stack Notation:

A stack is a linear data structure that follows the Last-In-First-Out (LIFO) principle. It can be represented using angle brackets:

``` stack<int> st; ```

This creates an integer stack named “st”.

## 4. Queue Notation:

A queue is another linear data structure that follows the First-In-First-Out (FIFO) principle. It can be represented using angle brackets as well:

``` queue<int> q; ```

This creates an integer queue named “q”.

## 5. Tree Notation:

A tree is a hierarchical data structure composed of nodes. It can be represented using various notations, such as:

• Bracket Notation:
``` [5 [3 [1 [] []] [4 [] []]] [8 [6 [] []] [9 [] []]]] ```

• Pointer Notation:
``` struct Node { int data; struct Node* left; struct Node* right;} *root; ```

## 6. Graph Notation:

A graph is a non-linear data structure consisting of nodes (vertices) and edges connecting them. It can be represented using various notations, such as adjacency matrix or adjacency list.

### – Adjacency Matrix Notation:

An adjacency matrix represents connections between vertices using a two-dimensional matrix. Each cell indicates whether there is an edge between two vertices:

``` A B C A 0 1 0 B 1 0 1 C 0 1 0 ```

### – Adjacency List Notation:

An adjacency list represents connections between vertices using a list of adjacent vertices for each vertex:

``` vector<int> adjList[N]; ```

This creates an array of vectors, where each vector contains the adjacent vertices for a particular vertex.

Understanding these notations is crucial when implementing data structures in various programming languages. They provide a standardized way to represent and work with different data structures, making it easier to communicate and collaborate with other developers.

By utilizing these HTML styling elements like bold () and underline () text, as well as proper use of lists (

/

• ) and subheaders (

Privacy Policy