Articles for author: Sindhuja Gudala

Largest Number Formed from an Array

Problem Statement Given an array of N positive integers, arrange these integers in such a manner that when we join the elements, it is maximum among all possible permutations of the array elements. (Basically: Find the Largest Number Formed From an Array) Example Input: arr = [3, 30, 40, 9] Output: [9, 40, 3, 30] ...

Expression Tree

This article mainly explains Expression trees. Expression trees are binary trees where the internal nodes denote operators (“+”, “-“, “/”, “*”,”^”) whereas the leaf nodes denote operands. These expression trees are used to implement or represent various kinds of expressions like infix, postfix, and prefix expressions. What is the Expression Tree? Expression trees are the binary trees that are used to ...

Longest Common Substring

Problem statement: Given two strings string_1 and string_2 of size N and M respectively. Find the length of the longest common substring. The problem statement says that we are given two strings and we need to return the length of the longest common substring from the given strings. For example: Input: Output: Explanation: The longest common substring from string_1 and string_2 of lengths N ...

Zero Sum Subarrays

Problem Statement Given an integer array where the array has both negative and positive values, print all the subarrays from the given array whose sum is zero. Example Let’s consider the below-given integer array: Input : arr = [0, -1, 8, -5, -3, -7, 4, 2, 1] Output for the given array is: Explanation Subarrays formed ...

What is Hamming code?

When we are transmitting data from sender to receiver, there might be a chance of error in the data while transmitting, Hamming code is the set of codes that helps in error detection as well as error correction in the data during transmission. The prerequisite for understanding the basics of error detection and correction can ...

What are the Types of Linked Lists in Data Structure?

Linked List is a linear data structure that consists of nodes. Each node in the linked list has both “data” and “links” i.e pointers of the next or previous nodes or both. These nodes are connected to the adjacent nodes using links or pointers. The nodes in the linked lists need not be stored at contiguous memory locations. This article mainly explains ...

Subset Sum Problem

Problem Statement You have a collection of non-negative values, representing available options, and a non-negative target value. Your task is to determine whether there exists a subset within the collection whose sum equals the given target value. Example Example1:   Example2: Approach 1: Using Recursion We can approach the Subset Sum Problem recursively by considering ...

Tower of Hanoi Algorithm

The Tower of Hanoi problem consists of three rods (for example A, B, and C) and N disks initially stacked on rod A in decreasing order of diameter (smallest one is at the top). The goal is to transfer the entire stack to another rod (in this case, rod C) with the help of auxiliary rod(in this ...