Limited Period Offer : 20% Discount on online/offline courses, for more details call/whatsapp

HashMaps

0 min read
1 year ago By Aniket Prajapati

HashMaps:

HashMaps are used to store the data as in the form of its keys and vales . Also Maps can be used so that suppose you have to do certain operation but for that you need to store the previous traversed data so for that you can use maps and store the data with its address so that you can access it and manipulate it however you want.

Ususally hashmaps are of two type (1) Ordered Map: -> The data is stored in increasing order ->Self balancing Binary Search Tree ->Search time complexity : O(log n) ->Inserting time : O(N) ->Deleting time : O(N)

(2) Unordered Map: -> The data is stored in no ordering ->Hashtables ->Search time complexity : O(N) ->Inserting time : O(N) ->Deleting time : O(N)

Code to implementing maps and printing data
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int arr[5]={10,20,30,40,50};
    map<int,int>mp; // declaring map which have 2 values of int type where first is key and another is value.
    for(int i=0;i<5;i++)
    {
        mp[i]=arr[i];
    }
    for(auto x:mp)
    {
        cout<<x.first<<" - "<<x.second<<endl;
    }

    return 0;
}
Sep 06, 2023 19:08 Back to Articles

Other Articles

For Laravel Setting UP CI/CD Pipeline using GitHub, CodeDeploy, S3 and EC2

Setting ci/cd pipeline for laravel application on aws using github actions then uploading to s3 and using codedeploy application gets installled on EC2 instance

1 year ago By Santosh Kshirsagar
Top 10 Web Frameworks of 2023 Top 10 Web Frameworks of 2023

As technology evolves and new trends arise, the landscape of web frameworks is continually shifting. This article will present the top 10 web frameworks to consider in 2023.

1 year ago By Mitali Gupta
How to identify Stack Questions? How to identify Stack Questions?

In this article, you will get clarity about how to find any given question that can be solved using stack.

1 year ago By Aniket Prajapati
Real DOM VS Virtual DOM

In this article, we will discuss the differences between the real DOM and the virtual DOM in the context of web development. We'll explore how these concepts impact the performance and efficiency of web applications, and how they contribute to the overall user experience. By the end of this article, you'll have a clear understanding of the distinctions between these two approaches to managing and updating user interfaces on the web.

1 year ago By Mitali Gupta