What do you want to save?
Add Code snippet
New code examples
-
C++ 2021-10-26 07:32:10
priority queue cpp
/* A priority queue maintains a set of elements. The supported operations are insertion and, depending on the type of the queue, retrieval and removal of either the minimum or maximum element. Insertion and removal take O(logn) time, and retrieval takes... Add solution -
C++ 2021-10-04 01:56:06
Reorganize String
#include<iostream> #include<string> #include<algorithm> #include<unordered_map> #include<queue> using namespace std; class Solution { public: string reorganizeString(string s) { unordered_map<char, int> um; ... Add solution -
Python 2021-09-23 16:25:05
dijkstra implementation with the help of priority queue in python
import heapq def calculate_distances(graph, starting_vertex): distances = {vertex: float('infinity') for vertex in graph} distances[starting_vertex] = 0 pq = [(0, starting_vertex)] while len(pq) > 0: current_distance, current... Add solution
Best helpers
Ranking is empty