Technology > Coding

Data structure and different types

A data structure is a collection of data type 'values' which are stored and organized in such a way that it allows for efficient access and modification. When we think of data structures, there are generally four forms:Linear: arrays, lists. Tree: binary, heaps, space partitioning etc.

Data structures is a way of organizing and storing the data in a computer so that it can be accessed and modified efficiently. The main idea is to reduce the space and time complexities of different tasks.

NON-PRIMITIVE DATATYPES

The data types that are derived from primary data types are known as non-Primitive data types. These datatypes are used to store group of values.

Arrays :

Array is a data structure used to store homogeneous elements at contiguous locations. Size of an array must be provided before storing data.

Linked List :

A linked list is a linear data structure (like arrays) where each element is a separate object. Each element (that is node) of a list is comprising of two items – the data and a reference to the next node.

Types of Linked List :

Singly Linked List

Doubly Linked List

Stack :

A stack or LIFO (last in, first out) is an abstract data type that serves as a collection of elements, with two principal operations: push, which adds an element to the collection, and pop, which removes the last element that was added. In stack both the operations of push and pop takes place at the same end that is top of the stack. It can be implemented by using both array and linked list.

Queue :

A queue or FIFO (first in, first out) is an abstract data type that serves as a collection of elements, with two principal operations: enqueue, the process of adding an element to the collection.(The element is added from the rear side) and dequeue, the process of removing the first element that was added. (The element is removed from the front side). It can be implemented by using both array and linked list.

Tree :

A tree data structure can be defined recursively (locally) as a collection of nodes(starting at a root node), where each node is a data structure consisting of a value, together with a list of references to nodes (the "children"), with the constraints that no reference is duplicated, and none points to the root.

Graph :

A Graph is a non-linear data structure consisting of nodes and edges. The nodes are sometimes also referred to as vertices and the edges are lines or arcs that connect any two nodes in the graph.


PRIMITIVE DATATYPE
The primitive data types are the basic data types that are available in most of the programming languages. The primitive data types are used to represent single values.

  • Integer: This is used to represent a number without decimal point.

Eg: 12, 90

  • Float and Double: This is used to represent a number with decimal point.

Eg: 45.1, 67.3

  • Character : This is used to represent single character

Eg: ‘C’, ‘a’

  • String: This is used to represent group of characters.

Eg: "M.S.P.V.L Polytechnic College"

  • Boolean: This is used represent logical values either true or false.

Monica Planas

author

I am Professional Writer and Web Designer. I love to write articles.

Article comments

Leave a Reply

Popular Authors

Aaryan Rana (3)

I am an experienced digital marketing analyst with a passion for data-driven insights, optimizing campaigns, and driving business growth with 3years exp.

Anvi Apte (2)

Anvi Apte is a marketing research manager at Novus Insights, a leading research and analytics services company.

The Royal Palm (1)

With almost fifty years of experience, our elegant catering and banqueting company is located in the most convenient neighborhood on Long Island. At the Royal Palm, culinary and hospitality skills have been honored since the 1960s.

Latest Articles