Category - Hashing

Hashing

Java Programming – Design a data structure that supports insert, delete, search and getRandom in constant time

The idea is to use a resizable array (ArrayList in Java, vector in C) together with hashing. Resizable arrays support insert in Θ(1)

Hashing

Java Programming – Count distinct elements in every window of size k

An Efficient Solution is to use the count of previous window, while sliding the window. The idea is to create a hash map that stores elements.

Hashing

C++ Programming – Count distinct elements in every window of size k

An Efficient Solution is to use the count of previous window, while sliding the window. The idea is to create a hash map that stores elements.

Hashing

Python Programming – Longest Consecutive Subsequence

One Solution is to first sort the array and find the longest subarray with consecutive elements. Time complexity of this solution is O(nLogn).

Hashing

Java Programming – Longest Consecutive Subsequence

One Solution is to first sort the array and find the longest subarray with consecutive elements. Time complexity of this solution is O(nLogn).

C++ Programming – Union and Intersection of two Linked Lists

Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists.

Union and Intersection of two Linked Lists

Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists.

Python Programming – Binary Tree in Vertical Order Hashmap based Method

An efficient solution based on hash map is discussed. We need to check the Horizontal Distances from root for all nodes and two nodes have the same

C Programming – Union and Intersection of two Linked Lists

Given two Linked Lists, create union and intersection lists that contain union and intersection of the elements present in the given lists.

C++ Programming – Find whether an array is subset of another array

Given two arrays: arr1[0..m-1] and arr2[0..n-1]. Find whether arr2[] is a subset of arr1[] or not. Both the arrays are not in sorted order.

Course

Training

casino

casino