Articles for author: Tarandeep singh

Implement Queue Using stack

Problem Statement The problem statement here is to implement queue using stack.Queue is a linear data structure which follows First In First Out (FIFO) principle. This means that the element which is inserted first will be the one that will be removed first. Stack is also a linear data structure which follows Last In First ...

Binary Coded Decimal Addition

BCD addition transforms the simple sum of two numbers, A and B, into a binary-coded marvel, concatenating each digit’s binary form from their sum into a precise, digital-friendly format. What is BCD? BCD, or Binary Coded Decimal, is a unique encoding system where every decimal digit is represented by its 4-bit binary counterpart. This method ...

Detect Loop in Linked List

Problem Statement Given a linked list, check whether the linked list is having a loop or not(detect loop in linked list). A cycle exists in a linked list if it contains a node that may be accessed again by following the next pointer. Example Input: Output: True Explanation: linked list is having 6 nodes and the next ...

Palindrome String

A Palindrome string is a string which is equal to its reverse or we can say a string is palindrome if the reverse of the string is the same as the original one. Properties of Palindrome String A palindrome string is characterized by its symmetric structure, where the characters in the first half mirror those ...

Intersection of Two Arrays

Intersection Of Two Arrays Given two arrays Arr1[] and Arr2[] of length n and m, respectively. The task is to find the intersection of elements of Arr1 and Arr2. The intersection is the list of common and distinct elements between Arr1 and Arr2. The intersection list can be in any order. Example Input: Output: Explanation: Common elements between Arr1 and Arr2 is 1, 2, 3, 4, 5. So, [1, ...