Articles for category: Data Structures and Algorithms

DBMS MCQ

Question: What is the Full Form of DBMS? Options: Answer: b) Database Management System. Explanation:The DBMS full form is Database Management System. It is software that is used to store, manipulate, and query records stored in a certain database. We have several types of database management systems such as NoSQL database management systems (for example ...

Flattening a Linked List

Problem Statement Given a Linked List of size N, where every node of the linked list has either of the two pointer or can have both pointer. The sublinked(vertical linked list) and the horizontal linked list is in sorted order.Flatten this linked list such that all the nodes appear in a single level(horizontally) and the ...

Leaders in an Array

Problem Statement Given an array arr of size n with all unique elements. Print all Leaders in the array in any order. Note: A leader is an element of the array if it is greater than all the elements to its right side in the array. The rightmost element is always a leader in an ...

Maximum Sum Increasing Subsequence

Problem Statement An array of positive integers of size n is given. write a program to find the maximum sum increasing subsequence in the given array. The maximum sum increasing subsequence is a subsequence of an integer array where the sum is maximum and all of the elements are sorted in non decreasing order. Example ...

Insertion in linked list

Modify a Linked List by inserting a new node at the front, after a specified node, and at the end. These operations offer flexibility in updating the structure based on specific needs, enabling dynamic adjustments to the Linked List. Insertion at the Beginning of the Linked List Insertion at the Beginning of the Linked List ...

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 ...

Boyer Moore Algorithm

Problem Statement We are provided with an input pattern and a text (or string), and we need to search and print all the occurrences of the pattern in the string. Note: Use Boyer Moore’s algorithm for searching the pattern in the string. Refer to the Example and Explanation sections for more details and the Approach section to understand the working of the Boyer Moore algorithm. ...

Level Order Traversal in Spiral Form

Problem Statement Given a root node of a binary tree, print its level order traversal in spiral order. Example InputLet’s assume we have the following binary tree – Note that only the address of the root node is provided as the input. Output Example Explanation The simple level order traversal of the tree is – ...

Check If Two Strings are Anagram

An anagram string is a rearrangement of the letters of a given string to form another word or phrase, using all the original letters exactly once. For example, “listen” and “silent” are string anagrams of each other. In this article, we will be delving into what is anagram string. Problem Statement Given two strings consisting ...

Iterative Inorder Traversal

In the iterative inorder traversal of a binary tree, nodes are visited in the left, root, right sequence without using recursion. This traversal, which uses a stack for managing node sequence, is a key approach in processing binary trees, characterized by their two-node structure. We’ll explore how this method works and analyze its time and ...