can someone to test or fix a bug in codding in C++ , i try to make the Dijkstra's Algorithm.cpp ( i made it but not sure if works fine ?
#include<bits/stdc++.h>
using namespace std;
#define MAXN 1111
#define INF 999999999
vector< pair<int, int> >v[MAXN];
vector<int> djikstras(int source, int no_of_vertices) {
vector<int> dist(no_of_vertices, INF);
set< pair<int, int> > queue;
vector<bool> visited(no_of_vertices, false);
dist[source] = 0;
visited[source] = true;
queue.insert(make_pair(dist[source], source));
while(!queue.empty()) {
pair<int, int> front_p = *(queue.begin());
queue.erase(queue.begin());
int cur_dist = front_p.first;
int node = front_p.second;
for(int i=0; i<v[node].size(); i++) {
int to = v[node][i].first;
int weight = v[node][i].second;
if(dist[to] > cur_dist + weight) {
if(queue.find(make_pair(dist[to], to)) != queue.end()) {
queue.erase(make_pair(dist[to], to));
}
dist[to] = cur_dist + weight;
queue.insert(make_pair(dist[to], to));
}
}
}
return dist;
}

Stf was warned