DATA STRUCTURE


vinaykhatri
Vinay Khatri 26 November, 2021

Find the closest pair from two arrays

Problem Given two sorted arrays and an integer X, find one number from each array such that the …

vinaykhatri
Vinay Khatri 26 November, 2021

Find all symmetric pairs in an array of pairs

Problem Given an array of pairs, find all symmetric pairs in it. Symmetric pairs are two pairs (…

vinaykhatri
Vinay Khatri 26 November, 2021

Find an index of the maximum occurring element with equal probability

Problem Given an array of integers, find the most occurring element of the array and return any …

vinaykhatri
Vinay Khatri 22 November, 2021

Find the minimum difference between the index of two given elements p…

Problem Given two integers, find the minimum difference between their index in a given array in …

vinaykhatri
Vinay Khatri 22 November, 2021

Group elements of an array based on their first occurrence

Problem Given an unsorted array, the task is to group multiple occurrences of individual element…

vinaykhatri
Vinay Khatri 19 November, 2021

Smallest Subtree with All Deepest Nodes

Problem Given a binary tree, return the smallest subtree that has all the deepest nodes of the o…

vinaykhatri
Vinay Khatri 17 November, 2021

How to Generate Random Strings and Passwords in Python?

To generate random data in Python, we generally use Python's random module.  And in this t…

vinaykhatri
Vinay Khatri 27 October, 2021

Quicksort algorithm using Hoare’s partitioning scheme

Problem Implement QuickSort using Hoare’s partition scheme. Approach Hoare's Par…

vinaykhatri
Vinay Khatri 27 October, 2021

Problems solved using partitioning logic of Quicksort

Problem What are some of the problems that can be solved using the partition logic of quicksort?…

vinaykhatri
Vinay Khatri 27 October, 2021

In-place vs out-of-place algorithms

In-Place algorithms This is a category of the algorithms that do not consume any extra space in …

vinaykhatri
Vinay Khatri 27 October, 2021

Sort elements by their frequency and index

Problem  Given an array of integers, sort them by their frequencies. If two elements have t…

vinaykhatri
Vinay Khatri 27 October, 2021

Find minimum and maximum with minimum number of comparisons

Problem Given an array of integers, find the minimum and maximum elements in it with a minimum n…