MCPcopy Index your code
hub / github.com/TheAlgorithms/JavaScript / leastFrequency

Method leastFrequency

Cache/LFUCache.js:112–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110 }
111
112 get leastFrequency() {
113 const freqCacheIterator = this.#frequencyMap.keys()
114 let leastFrequency = freqCacheIterator.next().value || null
115
116 // select the non-empty frequency Set
117 while (this.#frequencyMap.get(leastFrequency)?.size === 0) {
118 leastFrequency = freqCacheIterator.next().value
119 }
120
121 return leastFrequency
122 }
123
124 #removeCacheNode() {
125 const leastFreqSet = this.#frequencyMap.get(this.leastFrequency)

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected