What do you want to save?
Add Code snippet
New code examples
-
PHP 2022-03-27 22:35:13
Dijkstra’s algorithm php
$INT_MAX = 0x7FFFFFFF; function MinimumDistance($distance, $shortestPathTreeSet, $verticesCount) { global $INT_MAX; $min = $INT_MAX; $minIndex = 0; for ($v = 0; $v < $verticesCount; ++$v) { if ($shortestPathTreeSet[$v] == false &&... Add solution -
C++ 2022-03-27 12:15:21
find the graph is minimal spanig tree or not
#include <iostream> #include <vector> #include <utility> #include <algorithm> using namespace std; const int MAX = 1e4 + 5; int id[MAX], nodes, edges; pair <long long, pair<int, int> > p[MAX]; void initialize() { ... Add solution -
C++ 2022-03-15 06:55:06
segment tree complexity
// C++ program to show segment tree operations like construction, query // and update #include <bits/stdc++.h> using namespace std; // A utility function to get the middle index from corner indexes. int getMid(int s, int e) { return s + (e -s)... Add solution -
C++ 2022-03-14 07:05:04
constant variables in c++
// various versions of const are explained below #include <iostream> class Entity { private: int m_X, m_Y; mutable int var; // can be modified inside const menthods int* m_x, *m_y;// * use to create pointer in one line public: int GetX() const /... Add solution -
C++ 2022-03-12 02:30:03
prims c++
#include <iostream> #include <vector> #include <queue> #include <functional> #include <utility> using namespace std; const int MAX = 1e4 + 5; typedef pair<long long, int> PII; bool marked[MAX]; vector <PII> adj[M... Add solution -
C# 2022-03-03 11:15:21
sum array c#
int[] arr = new int[] { 1, 2, 3 }; int sum = 0; for (int i = 0; i < arr.Length; i++) { sum += arr[i]; } int[] arr = { 3, 6, 4, 1, 6, 8 }; // returns 1 Array.IndexOf(arr, 6); int maxValue = anArray.Max(); int maxIndex = anArray.ToList().IndexOf(m... Add solution -
C++ 2022-02-24 21:15:04
sliding window maximum sum subarray
#include <bits/stdc++.h> using namespace std; int main() { int n; cout<<"enter the size of the array:"<<endl; cin>>n; int arr[n]; cout<<"Enter the elements of the array:"<<endl;... Add solution