0
90kviews
Explain different types of data structures with an example
1 Answer
4
5.2kviews
  • Data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently. So, it is a special format for organizing and storing data. Arrays, linked lists, trees, graphs, etc. are all data structures.
  • Here are different types of data structures:-
  1. Array: It consists of a collection of elements, each identified by a common variable name and an index. A block of continuous memory is assigned for an array. Arrays may be one-dimensional or multidimensional

enter image description here

  1. Linked List: It consists of a group of nodes together which represent a sequence. It consists of two main parts: the data and a pointer pointing to the next node in the list. The start is marked by head pointer and the end is denoted by null pointer.

enter image description here.

  1. Tree: It has a set of nodes which have data and pointers or references. The pointers point to the children nodes of the node. The constraint is that no reference is duplicated and no node points to the root.

enter image description here

  1. Graph: It’s a collection of a set of vertices V and a set of edges E. Each edge E is a pair (v, w) where v and w are elements of V (i.e. they are vertices).

enter image description here

Please log in to add an answer.