Tag: data structure
Design and Implement a LRU (Least Recently Used) Cache that supports two operations i.e. get and set. get(key) – This method will retrieve the value (non-negative) of the key if …
Question : Given a sorted list represented by a directional link structure (as follows), remove the duplicates and return the new list. /** * Definition for singly-linked list. * …
Bubble sort is a very simple sorting technique that has the average and worst-case complexity . It swaps each time neighbouring two elements if it is not in order. …
The problem is from codeforces: http://www.codeforces.com/problemset/problem/278/A The problem can be simplified as the following: in a double-direction link, given two nodes, compute the shortest distance between them. There are only …
Disjoint Sets is one of the most powerful and yet simple data structure. The idea of Disjoint Sets can be perfectly applied in finding the minimal spanning tree. The …