View RandomCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.yazilimmimari.hackerrank; | |
import java.util.*; | |
public class RandomCache<S,T> { | |
HashMap<S,T> cache; | |
int capacity; | |
RandomCache(int capacity) { | |
cache = new HashMap<>(capacity); | |
this.capacity = capacity; |
View FIFOCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.yazilimmimari.hackerrank; | |
import java.util.LinkedHashMap; | |
import java.util.Map; | |
public class FIFOCache<S,T> { | |
LinkedHashMap<S,T> cache; | |
int capacity; | |
FIFOCache(int capacity) { | |
cache = new LinkedHashMap<>(capacity); |
View LFUCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.yazilimmimari.hackerrank; | |
import java.util.LinkedHashMap; | |
import java.util.Map; | |
import java.util.Objects; | |
public class LFUCache<S,T> { | |
public class Node<S,T> |
View LRUCache.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.yazilimmimari.hackerrank; | |
import java.util.LinkedHashMap; | |
import java.util.Map; | |
public class LRUCache<S,T> { | |
LinkedHashMap<S,T> cache; | |
int capacity; | |
LRUCache(int capacity) { | |
cache = new LinkedHashMap<>(capacity); |