Lesson 13 of 24
map ಮತ್ತು unordered_map
10 min 35 XP
map ಪ್ರತಿ key ಗೆ value ಸಂಗ್ರಹಿಸುತ್ತದೆ, keys sorted ಆಗಿರುತ್ತವೆ (O(log n)). unordered_map ಗೆ ಕ್ರಮವಿಲ್ಲ ಆದರೆ ಸರಾಸರಿ O(1). ಎಣಿಕೆ m[key]++ ನಷ್ಟು ಸುಲಭ.
Example: edit me and press Run
Output Loading C++ (first time takes a few seconds)
Press Run to see the result here.for (auto& [key, value] : m) C++17 structured bindings ಬಳಸುತ್ತದೆ. m[key] ಓದಿದಾಗ key ಇಲ್ಲದಿದ್ದರೆ 0 ಜೊತೆ ಸೇರುತ್ತದೆ; ಕೇವಲ ಪರಿಶೀಲನೆಗೆ count() ಅಥವಾ find() ಬಳಸಿ.