{"id":50292,"date":"2021-11-22T13:10:53","date_gmt":"2021-11-22T07:40:53","guid":{"rendered":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/"},"modified":"2024-09-03T11:08:36","modified_gmt":"2024-09-03T05:38:36","slug":"dijkstra-algorithm-c","status":"publish","type":"post","link":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/","title":{"rendered":"Dijkstra Algorithm C++"},"content":{"rendered":"\n<ul class=\"wp-block-list\">\n<li><a href=\"#Introduction\">Introduction<\/a><\/li>\n\n\n\n<li><a href=\"#WhatisGraph?\">What is Graph?<\/a><\/li>\n\n\n\n<li><a href=\"#WhatisDijkstra\u2019sAlgorithm?\">What is Dijkstra\u2019s Algorithm?<\/a><\/li>\n\n\n\n<li><a href=\"#HowDijkstra'sAlgorithmworks\">How Dijkstra's Algorithm works<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"introduction\"><strong>Introduction<\/strong><\/h2>\n\n\n\n<p>C++ can be defined as a general-purpose programming language that is widely used nowadays for competitive programming. It's imperative, object-oriented, and generic programming features. <a href=\"https:\/\/www.mygreatlearning.com\/blog\/simple-c-programs\/\" target=\"_blank\" rel=\"noreferrer noopener\">C++<\/a> runs on many platforms like Windows, <a href=\"https:\/\/www.mygreatlearning.com\/blog\/linux-tutorial\/\" target=\"_blank\" rel=\"noreferrer noopener\">Linux<\/a>, Unix, Mac, etc. C++ has numerous in-built functions which help us in Competitive programming also as development. While using CPP as our language, we do not get to know everything. We do not get to implement data structures whenever we are using CPP unless it's asked within the problem because we've STL in CPP. STL is an acronym for a normal template library. It's a group of <a href=\"https:\/\/www.mygreatlearning.com\/blog\/templates-in-cpp\/\" target=\"_blank\" rel=\"noreferrer noopener\">C++ template<\/a> classes that provide generic classes and performance, which will be wont to implement data structures and algorithms. STL provides numerous containers and algorithms which are very useful in competitive programming. These are required in almost every question, for instance, you'll very easily define a linked list with a single statement by using a list container of container library in STL or a stack or queue, etc. It saves a lot of time during the contest. <\/p>\n\n\n\n    <div class=\"courses-cta-container\">\n        <div class=\"courses-cta-card\">\n            <div class=\"courses-cta-header\">\n                <div class=\"courses-learn-icon\"><\/div>\n                <span class=\"courses-learn-text\">Academy Pro<\/span>\n            <\/div>\n            <p class=\"courses-cta-title\">\n                <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/learn-c-programming-for-beginners-to-advanced\" class=\"courses-cta-title-link\">C++ Programming Course<\/a>\n            <\/p>\n            <p class=\"courses-cta-description\">Master key C++ programming concepts like variables, functions, OOP, and control structures. Build real-world projects such as a banking system and grade management tool.<\/p>\n            <div class=\"courses-cta-stats\">\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-user-icon\"><\/div>\n                    <span>Beginner to Advanced Level<\/span>\n                <\/div>\n                <div class=\"courses-stat-item\">\n                    <div class=\"courses-stat-icon courses-star-icon\"><\/div>\n                    <span>8.1 hrs<\/span>\n                <\/div>\n            <\/div>\n            <a href=\"https:\/\/www.mygreatlearning.com\/academy\/premium\/learn-c-programming-for-beginners-to-advanced\" class=\"courses-cta-button\">\n                Start Free Trial\n                <div class=\"courses-arrow-icon\"><\/div>\n            <\/a>\n        <\/div>\n    <\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>STL (Standard template library) is a kind of generic library that contains the same container or algorithm that is often operated on any data type; you don\u2019t need to define an equivalent algorithm for various sorts of elements; we can just use them from STL.<\/p>\n\n\n\n<p>For example, a <a href=\"https:\/\/www.mygreatlearning.com\/blog\/selection-sort-algorithm\/\">sort algorithm<\/a> will sort the weather within the given range regardless of their data type. We don\u2019t need to implement different sort algorithms for various data types.<\/p>\n\n\n\n<p>STL containers help us implement algorithms that need more than one data structure, and now we will learn how it can help and save time.<\/p>\n\n\n\n<p>Today in this article, we'll study what's the graph and what's Dijkstra's algorithm in c++. Further, we'll study the instance of Dijkstra's algorithm in c++ code alongside its corresponding output. We\u2019ll also further study the sensible application of this algorithm within the world. So, let's get started!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-graph\"><strong>What is Graph?<\/strong><\/h2>\n\n\n\n<p>The graph may be a non-linear arrangement that involves nodes and edges. The nodes are the vertices, and the edges connect the 2 nodes within the graph. Therefore, the graph is often defined as a group of vertices and a group of edges that connect the nodes. If we consider Facebook as a graph, then the gathering of individuals on Facebook is taken into account as nodes. Therefore the connection between them is often considered as edges.<\/p>\n\n\n\n<figure class=\"wp-block-image is-style-default\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/-eBjeBVXWRraTDba5Wg2uZdCtmpH24CJYQdBO103IFrVntrgzJJ1ZmaTWS8LxZBQASk3jJqSr-sbQNHguRWGe_hDAJPdJi6_b1TUKvyLFIYmgIJR7y_Ltu5W2YwWAKhmX_7_-Z0\" alt=\"Chart\n\nDescription automatically generated with medium confidence\"\/><\/figure>\n\n\n\n<p>Vertex: Each node of the graph is named a vertex. Within the above graph, A, B, C, and D are the vertices of the graph.<\/p>\n\n\n\n<p>Edge: The link or path between two vertices is named a foothold. It connects two or more vertices. The various edges within the above graph are AB, BC, AD, and DC.<\/p>\n\n\n\n<p>Adjacent node: during a graph, if two nodes are connected by a foothold, then they're called adjacent nodes or neighbors. Within the above graph, edge AB connects the vertices A and B.so, A and B are adjacent nodes.<\/p>\n\n\n\n<p>Degree of the node: the number of edges that are connected to a specific node is named the degree of the node. Within the above graph, node A features a degree 2.<\/p>\n\n\n\n<p>Path: The sequence of nodes that we'd like to follow once we need to travel from one vertex to a different during a graph is named the trail. In our example graph, if we'd like to travel from node A to C, then the trail would be A-&gt;B-&gt;C.<\/p>\n\n\n\n<p>Closed path: If the initial node is the same as a terminal node, then that path is termed because of the closed path.<\/p>\n\n\n\n<p>Simple path: A closed path is named an easy path during which all the opposite nodes are distinct.<\/p>\n\n\n\n<p>Cycle: A path during which there are no repeated edges or vertices, and therefore the first and last vertices are equivalent to a cycle. within the above graph, A-&gt;B-&gt;C-&gt;D-&gt;A may be a cycle.<\/p>\n\n\n\n<p>Connected Graph: A connected graph is the one during which there's a path between each vertex. this suggests that there's not one vertex that is isolated or without a connecting edge. The graph shown above may be a connected graph.<\/p>\n\n\n\n<p>Complete Graph: A graph is named the entire graph during which each node is connected to a different node. If N is the total number of nodes during a graph, then the entire graph contains N(N-1)\/2 number of edges.<\/p>\n\n\n\n<p>Weighted graph: A positive value assigned to every edge indicating its length (distance between the vertices connected by an edge) is named weight. The graph containing weighted edges is named a weighted graph. The load of a foothold e is denoted by w(e), indicating the value of traversing a foothold.<\/p>\n\n\n\n<p>Diagraph: A digraph may be a graph during which every edge is related to a selected direction, and therefore the traversal is often wiped out specified direction only.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-dijkstras-algorithm\"><strong>What is Dijkstra\u2019s Algorithm?<\/strong><\/h2>\n\n\n\n<p>Dijkstra\u2019s algorithm is additionally referred to as the shortest path algorithm. It\u2019s an algorithm that wants to find the shortest path between nodes of the graph. The algorithm creates the tree of the shortest paths from the starting source vertex from all other points within the graph. It differs from the minimum spanning tree because the shortest distance between two vertices might not be included altogether in the vertices of the graph. The algorithm works by building or creating a group of nodes with a minimum distance from the beginning point. Here, Dijkstra's algorithm in c++ uses a greedy approach to unravel the matter and find the simplest solution.<\/p>\n\n\n\n<p>Let\u2019s just understand how this algorithm works and gives us the shortest path between the source and the destination.&nbsp;<\/p>\n\n\n\n<p>Dijkstra's algorithm in c++ allows us to seek out the shortest path between any two vertices of a graph.<\/p>\n\n\n\n<p>It differs from the minimum spanning tree because the shortest distance between two vertices won't include all the vertices of the graph.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-dijkstras-algorithm-works\"><strong>How Dijkstra's Algorithm works<\/strong><\/h2>\n\n\n\n<p>Dijkstra's Algorithm follows the idea that any subpath from B to D of the shortest path from A to D between vertices A and D is additionally the shortest path between vertices B and D.<\/p>\n\n\n\n<p>Dijkstra\u2019s algorithm employs the shortest subpath property.<\/p>\n\n\n\n<p>Each subpath is that the shortest path. Djikstra used this property in the other way, i.e., we overestimate the space of every vertex from the starting vertex. Then we visit each node and its neighbors to seek out the shortest subpath to those neighbors.<\/p>\n\n\n\n<p>The algorithm uses a greedy approach to discover the subsequent best solution, hoping that the top result's the simplest solution for the entire problem.&nbsp;<\/p>\n\n\n\n<p><strong>Rules we follow while working on Dijkstra\u2019s algorithm:-<\/strong><\/p>\n\n\n\n<p>First of all, we'll mark all vertex as unvisited vertex<\/p>\n\n\n\n<p>Then, we'll mark the source vertex as 0 and every other vertex as infinity<\/p>\n\n\n\n<p>Consider source vertex as current vertex<\/p>\n\n\n\n<p>Calculate the trail length of all the neighboring vertex from the present vertex by adding the load of the string within the current vertex<\/p>\n\n\n\n<p>Now, we will check&nbsp; if the new path length is smaller than the previous path length, then we will replace it; otherwise, ignore it<\/p>\n\n\n\n<p>Mark the present vertex as visited after visiting the neighbor vertex of the current vertex<\/p>\n\n\n\n<p>Select the vertex with the littlest path length because of the new current vertex and return to step 4.<\/p>\n\n\n\n<p>We will repeat this process unless all the vertices are marked as visited.<\/p>\n\n\n\n<p>Once we undergo the algorithm, we will backtrack to the source vertex and find our shortest path.<\/p>\n\n\n\n<p><strong>Pseudo Code of Dijkstra Algorithm using set data structures from STL.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const int INF = 1e7;\/\/defining the value of inf as 10000000\nvector&lt;vector&lt;pair&lt;int, int&gt;&gt;&gt; adj;\/\/adjacency list \n\nvoid dijkstra(int s, vector&lt;int&gt; &amp; d, vector&lt;int&gt; &amp; p) {\/\/function for implementing Dijkstra algo\n    int n = adj.size();\/\/ assigning the value of n which is equal to the size of adjency list\n    d.assign(n, INF);\n    p.assign(n, -1);\n\n    d&#091;s] = 0;\n    set&lt;pair&lt;int, int&gt;&gt; q;\n    q.insert({0, s});\n    while (!q.empty()) {\n        int v = q.begin()-&gt;second;\n        q.erase(q.begin());\/\/erasing the starting point\n\n        for (auto edge : adj&#091;v]) {\/\/range based loop \n            int to = edge.first;\/\/assigning to= first edge\n            int len = edge.second;\/\/assigning len = second edge\n\n            if (d&#091;v] + len &lt; d&#091;to]) {\/\/checking if d&#091;v]+len id lesser than d&#091;to]\n                q.erase({d&#091;to], to});\/\/if the condition satisfies then we will erase the q\n                d&#091;to] = d&#091;v] + len;\/\/assigning d&#091;to]= d&#091;v]+len\n                p&#091;to] = v;\/\/ assigning p&#091;to]=v;\n                q.insert({d&#091;to], to});\/\/Inserting the element\n            }\n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>Now let\u2019s just one problem on Dijsktras Algo.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;bits\/stdc++.h&gt;\nusing namespace std;\n\ntemplate&lt;typename T&gt;\/\/Template with which we can add any data type \nclass Graph {\/\/class graph \n\tmap&lt;T, list&lt;pair&lt;T, int&gt;&gt;&gt; l;\/\/declaration of nested map  l with T and list of pairs\n\npublic:\/\/public object\n\tvoid addEdge(T x, T y, int wt) {\/\/function addEdge will add anew edge in the graph\n\t\tl&#091;x].push_back({y, wt});\n\t\tl&#091;y].push_back({x, wt});\/\/to make the graph unidirectional just remove this line\n\/\/These line will make the graph directional \n\t}\n\n\tvoid print() {\n\t\tfor (auto p : l) {\n\t\t\tT node = p.first;\n\t\t\tcout &lt;&lt; node &lt;&lt; \" -&gt; \";\n\n\t\t\tfor (auto nbr : l&#091;node]) {\n\t\t\t\tcout &lt;&lt; \"(\" &lt;&lt; nbr.first &lt;&lt; \",\" &lt;&lt; nbr.second &lt;&lt; \") \";\n\t\t\t} cout &lt;&lt; endl;\n\t\t}\n\t}\n\n\tvoid djikstraSSSP(T src) {\n\n\t\tmap&lt;T, int&gt; dist;\n\n\t\t\/\/ Initialising dist to inf\n\t\tfor (auto p : l) {\n\t\t\tT node = p.first;\n\t\t\tdist&#091;node] = INT_MAX;\n\t\t}\n\t\tdist&#091;src] = 0;\n\n\t\t\/\/ set created to get the min dist element at the beginning\n\t\t\/\/ \t\tdist, node\n\t\tset&lt;pair&lt;int, T&gt;&gt; s;\n\t\ts.insert({dist&#091;src], src});\n\n\t\twhile (!s.empty()) {\n\n\t\t\tpair&lt;int, T&gt; p = *s.begin();\/\/defining pair T of int and T\n\t\t\ts.erase(s.begin());\n\t\t\tT currNode = p.second;\n\t\t\tint currNodeDist = p.first;\n\n\t\t\t\/\/ visit all nbrs of node\n\t\t\tfor (auto nbr : l&#091;currNode]) {\/\/range based loop\n\t\t\t\tT nbrNode = nbr.first;\n\t\t\t\tint distInBetween = nbr.second;\n\t\t\t\tint nbrNodeDist = dist&#091;nbrNode];\n\n\t\t\t\t\/\/ Potential new distance = currNodeDist + distInBetween\n\t\t\t\tif (currNodeDist + distInBetween &lt; nbrNodeDist) {\n\n\t\t\t\t\t\/\/ Update dist in both set and map\n\t\t\t\t\t\/\/ If node not present in set then add it\n\t\t\t\t\tauto pr = s.find({dist&#091;nbrNode], nbrNode});\n\t\t\t\t\tif (pr != s.end()) {\n\t\t\t\t\t\ts.erase(pr);\n\t\t\t\t\t}\n\t\t\t\t\tdist&#091;nbrNode] = currNodeDist + distInBetween;\n\t\t\t\t\ts.insert({dist&#091;nbrNode], nbrNode});\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tfor (auto x : dist) {\n\t\t\tcout &lt;&lt; x.first &lt;&lt; \" is at distance \" &lt;&lt; x.second &lt;&lt; \" from source\" &lt;&lt; endl;\n\t\t}\n\n\n\n\t}\n\n};\n\nint main() {\n\n\tGraph&lt;string&gt; g;\n\n\tg.addEdge(\"Amritsar\", \"Delhi\", 1);\/\/Adding some edges in the graph\n\tg.addEdge(\"Amritsar\", \"Jaipur\", 4);\n\tg.addEdge(\"Delhi\", \"Jaipur\", 2);\n\tg.addEdge(\"Mumbai\", \"Jaipur\", 8);\n\tg.addEdge(\"Bhopal\", \"Agra\", 2);\n\tg.addEdge(\"Mumbai\", \"Bhopal\", 3);\n\tg.addEdge(\"Agra\", \"Delhi\", 1);\n\n\tg.print();\n\tcout &lt;&lt; endl;\n\tg.djikstraSSSP(\"Amritsar\");\n\tcout &lt;&lt; endl;\n\tg.djikstraSSSP(\"Delhi\");\n}\n<\/code><\/pre>\n\n\n\n<p>Output Snippets<\/p>\n\n\n\n<p><strong>Agra -&gt; (Bhopal,2) (Delhi,1)<\/strong><\/p>\n\n\n\n<p><strong>Amritsar -&gt; (Delhi,1) (Jaipur,4)<\/strong><\/p>\n\n\n\n<p><strong>Bhopal -&gt; (Agra,2) (Mumbai,3)<\/strong><\/p>\n\n\n\n<p><strong>Delhi -&gt; (Amritsar,1) (Jaipur,2) (Agra,1)<\/strong><\/p>\n\n\n\n<p><strong>Jaipur -&gt; (Amritsar,4) (Delhi,2) (Mumbai,8)<\/strong><\/p>\n\n\n\n<p><strong>Mumbai -&gt; (Jaipur,8) (Bhopal,3)<\/strong><\/p>\n\n\n\n<p><strong>Agra is at distance 2 from source<\/strong><\/p>\n\n\n\n<p><strong>Amritsar is at distance 0 from source<\/strong><\/p>\n\n\n\n<p><strong>Bhopal is at distance 4 from source<\/strong><\/p>\n\n\n\n<p><strong>Delhi is at distance 1 from source<\/strong><\/p>\n\n\n\n<p><strong>Jaipur is at distance 3 from source<\/strong><\/p>\n\n\n\n<p><strong>Mumbai is at distance 7 from source<\/strong><\/p>\n\n\n\n<p><strong>Agra is at distance 1 from source<\/strong><\/p>\n\n\n\n<p><strong>Amritsar is at distance 1 from source<\/strong><\/p>\n\n\n\n<p><strong>Bhopal is at distance 3 from source<\/strong><\/p>\n\n\n\n<p><strong>Delhi is at distance 0 from source<\/strong><\/p>\n\n\n\n<p><strong>Jaipur is at distance 2 from source<\/strong><\/p>\n\n\n\n<p><strong>Mumbai is at distance 6 from source<\/strong><\/p>\n\n\n\n<p><strong>ADVANTAGES OF DIJKSTRA\u2019S ALGORITHM<\/strong><\/p>\n\n\n\n<p>\u2022 Once it's been administered, you'll find the smallest amount of weight path to all or any permanently labeled nodes.<\/p>\n\n\n\n<p>\u2022 You don\u2019t need a replacement diagram for every pass.<\/p>\n\n\n\n<p>\u2022 Dijkstra\u2019s algorithm has a time complexity of O(n^2), so it's efficient enough to use for relatively large problems.<\/p>\n\n\n\n<p><strong>DISADVANTAGES OF DIJKSTRA\u2019S ALGORITHM<\/strong><\/p>\n\n\n\n<p>\u2022 The main disadvantage of the Dijkstra's algorithm in C++ is the indisputable fact that it does a blind search, thereby consuming tons of your time, wasting necessary resources.<\/p>\n\n\n\n<p>\u2022 Another disadvantage is that it is not applicable for a graph with negative edges. This results in acyclic graphs and most frequently cannot obtain the proper shortest path.<\/p>\n\n\n\n<p><strong>APPLICATIONS<\/strong><\/p>\n\n\n\n<p>\u2022 Traffic information systems such as Google Maps uses Dijkstra\u2019s algorithm to trace the shortest distance between the source and destinations from a given particular starting point.<\/p>\n\n\n\n<p>Which uses a link-state within the individual areas that structure's the hierarchy. The computation is predicated on Dijkstra\u2019s algorithm, which calculates the shortest path in the tree inside each area of the network.&nbsp;<\/p>\n\n\n\n<p>\u2022 OSPF- Open Shortest Path First, mostly used in Internet routing.<\/p>\n\n\n\n<p>These were a few of the applications, but there is a lot more for this algorithm.<\/p>\n\n\n\n<p><strong>RELATED ALGORITHMS<\/strong><\/p>\n\n\n\n<p>A* algorithm is a graph\/tree search algorithm mostly used in Artificial Intelligence that finds a path from a given initial node to a given goal node. It employs a \u201d heuristic estimate\u201d h(x) that provides an estimate of the simplest route that goes through that node. It visits the nodes, so as of this heuristic estimate. It follows the approach of the breadth-first search.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction C++ can be defined as a general-purpose programming language that is widely used nowadays for competitive programming. It's imperative, object-oriented, and generic programming features. C++ runs on many platforms like Windows, Linux, Unix, Mac, etc. C++ has numerous in-built functions which help us in Competitive programming also as development. While using CPP as our [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":37977,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[25860],"tags":[],"content_type":[],"class_list":["post-50292","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Dijkstra&#039;s algorithm in C++ - Great Learning<\/title>\n<meta name=\"description\" content=\"Dijkstra&#039;s algorithm in C++ can be defined as a general-purpose programming language that is referred to as the shortest path algorithm.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dijkstra Algorithm C++\" \/>\n<meta property=\"og:description\" content=\"Dijkstra&#039;s algorithm in C++ can be defined as a general-purpose programming language that is referred to as the shortest path algorithm.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/\" \/>\n<meta property=\"og:site_name\" content=\"Great Learning Blog: Free Resources what Matters to shape your Career!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GreatLearningOfficial\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-11-22T07:40:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-03T05:38:36+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1287\" \/>\n\t<meta property=\"og:image:height\" content=\"815\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Great Learning Editorial Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/Great_Learning\" \/>\n<meta name=\"twitter:site\" content=\"@Great_Learning\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Great Learning Editorial Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/\"},\"author\":{\"name\":\"Great Learning Editorial Team\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\"},\"headline\":\"Dijkstra Algorithm C++\",\"datePublished\":\"2021-11-22T07:40:53+00:00\",\"dateModified\":\"2024-09-03T05:38:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/\"},\"wordCount\":1720,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/iStock-1202093404.jpg\",\"articleSection\":[\"IT\\\/Software Development\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/\",\"name\":\"Dijkstra's algorithm in C++ - Great Learning\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/iStock-1202093404.jpg\",\"datePublished\":\"2021-11-22T07:40:53+00:00\",\"dateModified\":\"2024-09-03T05:38:36+00:00\",\"description\":\"Dijkstra's algorithm in C++ can be defined as a general-purpose programming language that is referred to as the shortest path algorithm.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/iStock-1202093404.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/06\\\/iStock-1202093404.jpg\",\"width\":1287,\"height\":815,\"caption\":\"Developing programming and coding technologies. Website design. Programmer working in a software develop company office.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/dijkstra-algorithm-c\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"IT\\\/Software Development\",\"item\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/software\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Dijkstra Algorithm C++\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"name\":\"Great Learning Blog\",\"description\":\"Learn, Upskill &amp; Career Development Guide and Resources\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\"},\"alternateName\":\"Great Learning\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#organization\",\"name\":\"Great Learning\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/GL-Logo.jpg\",\"width\":900,\"height\":900,\"caption\":\"Great Learning\"},\"image\":{\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/GreatLearningOfficial\\\/\",\"https:\\\/\\\/x.com\\\/Great_Learning\",\"https:\\\/\\\/www.instagram.com\\\/greatlearningofficial\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/in.pinterest.com\\\/greatlearning12\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/beaconelearning\\\/\"],\"description\":\"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.\",\"email\":\"info@mygreatlearning.com\",\"legalName\":\"Great Learning Education Services Pvt. Ltd\",\"foundingDate\":\"2013-11-29\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"1001\",\"maxValue\":\"5000\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/#\\\/schema\\\/person\\\/6f993d1be4c584a335951e836f2656ad\",\"name\":\"Great Learning Editorial Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"contentUrl\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/unnamed.webp\",\"caption\":\"Great Learning Editorial Team\"},\"description\":\"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.\",\"sameAs\":[\"https:\\\/\\\/www.mygreatlearning.com\\\/\",\"https:\\\/\\\/in.linkedin.com\\\/school\\\/great-learning\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/Great_Learning\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCObs0kLIrDjX2LLSybqNaEA\"],\"award\":[\"Best EdTech Company of the Year 2024\",\"Education Economictimes Outstanding Education\\\/Edtech Solution Provider of the Year 2024\",\"Leading E-learning Platform 2024\"],\"url\":\"https:\\\/\\\/www.mygreatlearning.com\\\/blog\\\/author\\\/greatlearning\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Dijkstra's algorithm in C++ - Great Learning","description":"Dijkstra's algorithm in C++ can be defined as a general-purpose programming language that is referred to as the shortest path algorithm.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/","og_locale":"en_US","og_type":"article","og_title":"Dijkstra Algorithm C++","og_description":"Dijkstra's algorithm in C++ can be defined as a general-purpose programming language that is referred to as the shortest path algorithm.","og_url":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/","og_site_name":"Great Learning Blog: Free Resources what Matters to shape your Career!","article_publisher":"https:\/\/www.facebook.com\/GreatLearningOfficial\/","article_published_time":"2021-11-22T07:40:53+00:00","article_modified_time":"2024-09-03T05:38:36+00:00","og_image":[{"width":1287,"height":815,"url":"http:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404.jpg","type":"image\/jpeg"}],"author":"Great Learning Editorial Team","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/Great_Learning","twitter_site":"@Great_Learning","twitter_misc":{"Written by":"Great Learning Editorial Team","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/#article","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/"},"author":{"name":"Great Learning Editorial Team","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad"},"headline":"Dijkstra Algorithm C++","datePublished":"2021-11-22T07:40:53+00:00","dateModified":"2024-09-03T05:38:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/"},"wordCount":1720,"commentCount":0,"publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404.jpg","articleSection":["IT\/Software Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/","url":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/","name":"Dijkstra's algorithm in C++ - Great Learning","isPartOf":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/#primaryimage"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404.jpg","datePublished":"2021-11-22T07:40:53+00:00","dateModified":"2024-09-03T05:38:36+00:00","description":"Dijkstra's algorithm in C++ can be defined as a general-purpose programming language that is referred to as the shortest path algorithm.","breadcrumb":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/#primaryimage","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404.jpg","width":1287,"height":815,"caption":"Developing programming and coding technologies. Website design. Programmer working in a software develop company office."},{"@type":"BreadcrumbList","@id":"https:\/\/www.mygreatlearning.com\/blog\/dijkstra-algorithm-c\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/www.mygreatlearning.com\/blog\/"},{"@type":"ListItem","position":2,"name":"IT\/Software Development","item":"https:\/\/www.mygreatlearning.com\/blog\/software\/"},{"@type":"ListItem","position":3,"name":"Dijkstra Algorithm C++"}]},{"@type":"WebSite","@id":"https:\/\/www.mygreatlearning.com\/blog\/#website","url":"https:\/\/www.mygreatlearning.com\/blog\/","name":"Great Learning Blog","description":"Learn, Upskill &amp; Career Development Guide and Resources","publisher":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization"},"alternateName":"Great Learning","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mygreatlearning.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.mygreatlearning.com\/blog\/#organization","name":"Great Learning","url":"https:\/\/www.mygreatlearning.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/06\/GL-Logo.jpg","width":900,"height":900,"caption":"Great Learning"},"image":{"@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/GreatLearningOfficial\/","https:\/\/x.com\/Great_Learning","https:\/\/www.instagram.com\/greatlearningofficial\/","https:\/\/www.linkedin.com\/school\/great-learning\/","https:\/\/in.pinterest.com\/greatlearning12\/","https:\/\/www.youtube.com\/user\/beaconelearning\/"],"description":"Great Learning is a leading global ed-tech company for professional training and higher education. It offers comprehensive, industry-relevant, hands-on learning programs across various business, technology, and interdisciplinary domains driving the digital economy. These programs are developed and offered in collaboration with the world's foremost academic institutions.","email":"info@mygreatlearning.com","legalName":"Great Learning Education Services Pvt. Ltd","foundingDate":"2013-11-29","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"1001","maxValue":"5000"}},{"@type":"Person","@id":"https:\/\/www.mygreatlearning.com\/blog\/#\/schema\/person\/6f993d1be4c584a335951e836f2656ad","name":"Great Learning Editorial Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","url":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","contentUrl":"https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2022\/02\/unnamed.webp","caption":"Great Learning Editorial Team"},"description":"The Great Learning Editorial Staff includes a dynamic team of subject matter experts, instructors, and education professionals who combine their deep industry knowledge with innovative teaching methods. Their mission is to provide learners with the skills and insights needed to excel in their careers, whether through upskilling, reskilling, or transitioning into new fields.","sameAs":["https:\/\/www.mygreatlearning.com\/","https:\/\/in.linkedin.com\/school\/great-learning\/","https:\/\/x.com\/https:\/\/twitter.com\/Great_Learning","https:\/\/www.youtube.com\/channel\/UCObs0kLIrDjX2LLSybqNaEA"],"award":["Best EdTech Company of the Year 2024","Education Economictimes Outstanding Education\/Edtech Solution Provider of the Year 2024","Leading E-learning Platform 2024"],"url":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"}]}},"uagb_featured_image_src":{"full":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404.jpg",1287,815,false],"thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404-150x150.jpg",150,150,true],"medium":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404-300x190.jpg",300,190,true],"medium_large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404-768x486.jpg",768,486,true],"large":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404-1024x648.jpg",1024,648,true],"1536x1536":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404.jpg",1287,815,false],"2048x2048":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404.jpg",1287,815,false],"web-stories-poster-portrait":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404-640x815.jpg",640,815,true],"web-stories-publisher-logo":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404-96x96.jpg",96,96,true],"web-stories-thumbnail":["https:\/\/www.mygreatlearning.com\/blog\/wp-content\/uploads\/2021\/06\/iStock-1202093404-150x95.jpg",150,95,true]},"uagb_author_info":{"display_name":"Great Learning Editorial Team","author_link":"https:\/\/www.mygreatlearning.com\/blog\/author\/greatlearning\/"},"uagb_comment_info":0,"uagb_excerpt":"Introduction C++ can be defined as a general-purpose programming language that is widely used nowadays for competitive programming. It's imperative, object-oriented, and generic programming features. C++ runs on many platforms like Windows, Linux, Unix, Mac, etc. C++ has numerous in-built functions which help us in Competitive programming also as development. While using CPP as our&hellip;","_links":{"self":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/50292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/comments?post=50292"}],"version-history":[{"count":6,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/50292\/revisions"}],"predecessor-version":[{"id":111505,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/posts\/50292\/revisions\/111505"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media\/37977"}],"wp:attachment":[{"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/media?parent=50292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/categories?post=50292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/tags?post=50292"},{"taxonomy":"content_type","embeddable":true,"href":"https:\/\/www.mygreatlearning.com\/blog\/wp-json\/wp\/v2\/content_type?post=50292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}