Articles for category: Data Structures and Algorithms

Difference Between Stack and Queue Data Structures

There are many data structures like arrays, linked lists, and trees that are used to organise the data in a particular manner. A stack and a queue are two other data structures that are used to organise data. Both of them are linear data structures, which means they store and retrieve the elements in a sequencial manner from the structure when required. Stack ...

Dynamic Data Structures

A data structure is a way of storing, organizing, and efficiently maintaining data concerning both time and space. Data structures can be of two types, static and dynamic data structures. Static data structures are the ones in which the size of the structure is predefined and fixed. On the other hand, dynamic data structures are the ones whose size ...

Graph Representation

Graphs, as non-linear data structures comprising nodes and edges, represent relationships between entities. Three classic graph representation in data structure include Adjacency Matrix, Adjacency List, and Incidence Matrix. While Adjacency Matrix offers fast edge retrieval but consumes more space, Adjacency List is space-efficient but slower for edge retrieval. Incidence Matrix is rarely used due to its inefficient space utilization and slower ...

How to Convert Infix to Prefix Notation?

An infix expression is one that we use regularly. A single letter or operator followed by one infix string and another infix string makes up an infix expression such as A, A + B, and (A + B) + (C – D). Therefore, there are operators between operands in this. If the operator appears in an expression before the ...

Difference between Recursion and Iteration

The set of instructions is repeated using both recursion and iteration. When a statement within a function repeatedly invokes itself, recursion occurs. Iteration happens when a loop runs repeatedly until the controlling condition is satisfied. Recursion and iteration vary fundamentally doing the same thing. iteration is used to apply a set of instructions that we want ...

How to Master Data Structures and Algorithms?

Data Structures and algorithms is one of the most important topics that you need to have knowledge of along the path of being a software developer. The knowledge of this topic helps solve problems much more easily in the real world. It’s a skill that comes with practice. In this article, I will speak about the best ...

Height of Tree

A tree is a nonlinear hierarchical data structure that consists of nodes connected by edges. The most common type of tree is the binary tree. In this, each node has 2 children, i.e., Left and Right. The node that doesn’t have any parents is known as the root node, and the node that doesn’t have any children nodes is known as the leaf node. ...