Articles for author: Shubhrima Jana

Preorder to Postorder Traversal

Problem Statement Given an array that represents the preorder traversal of a binary search tree, write a program to find the postorder traversal of the BST. Example The preorder of a BST is given below:preorder[] = {10, 5, 8, 25, 47}The postorder for the example will be:postorder[] = {8, 5, 47, 25, 10} Example Explanation ...

Merge Two Sorted Arrays without Extra Space

Problem Statement Given the sorted arrays nums1[]nums1[] and nums2[]nums2[] of sizes n and m in non-decreasing order. Merge without extra space in sorted, non-decreasing order such that nums1 contains the first n elements, and nums2 contains the last m elements. Example Example Explanation The following two arrays are given : Try to merge two sorted arrays without extra space such that the smallest n elements are present in the first array and the ...

Types of Binary Tree

Binary trees are a fundamental data structure with various types. The two primary types of binary tree are full binary trees, where each node has either two children or no children, and complete binary trees, which are filled from left to right at each level. Additionally, there are balanced types of binary tree, such as ...

Wave Array

Problem Statement Sort an unsorted array arr of length n in a waveform. An array is said to be in wave form if it satisfies the following conditions: Example Example Explanation Input: arr = [7, 7, 11, 3, 4, 5, 15] Output: [4, 3, 7, 5, 11, 7, 15] or any other array in wave form. Explanation: In the ...

Time and Space Complexity of Binary Search

Binary Search is an efficient algorithm designed for searching within a sorted list of items. Its approach involves iteratively dividing the search space in half, until the target element found in the array. The time complexity of the Binary Search Algorithm is $O(log_2{n})$, Where n is the size of the sorted linear array. It means ...

Remove Duplicates from an Unsorted Linked List

Problem Statement Write a program to delete duplicate nodes present in an unsorted linked list. Print the original linked list, and the linked list obtained after the deletions. Example Consider the following linked list : After you remove duplicates from the linked list : Example Explanation The given unsorted linked list is : There are multiple occurrences ...

Shubhrima Jana

Flow Control and Error Control

Data Link Layer is responsible for reliable point-to-point data transfer over a physical medium. To implement this data link layer provides three functions : What is Flow Control in the Data Link Layer? Flow control is a set of procedures that restrict the amount of data a sender should send before it waits for some acknowledgment from the ...