Skip to main content
Filter by
Sorted by
Tagged with
3 votes
1 answer
196 views

I am sitting on a LeetCode problem, specifically Minimum Time to Repair Cars. You get a list of how many mechanics you have and how many cars you need to fix. Each mechanic has a rank, and he takes ...
MaxH's user avatar
  • 75
2 votes
4 answers
185 views

I'm working on a problem where I need to maintain the median of a data stream, but unlike typical implementations that only support insertions, I also need to support deletions of arbitrary values. ...
Aditya Rawat's user avatar
0 votes
0 answers
36 views

I am working on proving the correctness of a Priority Queue implementation in Coq. I am getting stuck in the else branch of my insert theoreom. (I had to change my OG inductive hypothesis to better ...
balllerz21's user avatar
0 votes
1 answer
251 views

I found this LeetCode style problem in a previous assignment for my university. Assume you have an online clothing store and you have products which come in variable sizes. Some products come in the ...
user29783602's user avatar
1 vote
0 answers
93 views

I'm working on implementing a Double-Ended Priority Queue (DEAP) data structure in C++. I'm having trouble with establishing the correct implementation of node partnerships between the min and max ...
benhpark's user avatar
0 votes
1 answer
445 views

I'm really having a hard time with Microsoft's implementation of PriorityQueue because it's missing most of the extension methods that you'll find in other collections. There is no ToArray method, ...
Kris Craig's user avatar
-1 votes
1 answer
104 views

class Solution { class City{ int city; long time; City(int c, long t){ city = c; time = t; } } public int countPaths(int n, int[][] ...
Silent Prime's user avatar
-1 votes
1 answer
246 views

I have a problem to solve. Details of it basically irrelevant & I have two valid solutions for it: in python and Haskell. Python code: import heapq _, volume, *ppl = map(int, open("input.txt&...
mesenev's user avatar
0 votes
1 answer
100 views

I'm working with a priority_queue in C++ and encountered a problem when using a static member function as a custom comparator within a class. A reproducible example will be: #include <bits/stdc++.h&...
DanielRicky's user avatar
1 vote
4 answers
288 views

Doing some leetcoding. Top K frequent elements. I'm implementing my solution via Max Heap. Can someone please help me understand the PriorityQueue comparator syntax? Map<Integer, Integer> map = ...
Alisha's user avatar
  • 123
0 votes
1 answer
179 views

i have this example code: @router.post('/test') def Test(): for i in range(0,10): Testy.apply_async([i],priority=7) return "done" @app.task(bind=True) def Testy(self,i): ...
setareh samami's user avatar
0 votes
0 answers
273 views

I use Celery to process background jobs that use a blocking API for a Django web app. Since the API can only process one job at a time, I also use a lock (implemented with Redis) to ensure that only ...
allo's user avatar
  • 4,306
-1 votes
1 answer
51 views

I have a pair class. public class Pair { public int freq; public int coolTime; public Pair(int freq, int coolTime) { this.freq = freq; this.coolTime = coolTime; ...
codingBeast's user avatar
-2 votes
1 answer
140 views

I want to get the sorted key value pair on value, and if the values are equal, I wanna sort on keys asc. I tried using PriorityQueue like following but I am getting null pointer for some reason. ...
Shubham Kumbhalkar's user avatar
0 votes
1 answer
71 views

I'm trying to create varaible of type 'std::priority_queue' like this: struct { bool operator()(std::vector<int> v1, std::vector<int> v2){return (v1[2] + v1[3]) > (v2[2] + v2[3]);}; ...
zeregzesis's user avatar
0 votes
2 answers
250 views

I have an assignment that asks me to implement a priority queue with binary heap in c. I have a problem because basically, the input data that we get looks like this: 7 - number of occurences 3 4 0 5 ...
szkly's user avatar
  • 1
-1 votes
1 answer
50 views

I have a Priority Queue that containst an Object called it 'RouteInfo', public class RouteInfo{ private double totalCost; private double totalLeadTime; private int numberOfLanes; ...
Ragin P M's user avatar
-2 votes
1 answer
89 views

I'm trying to implement a kind of 'weighted queue extractor' to extract elements from different queues having different priorities. I just have to choose the queue I've to get an element from. Let's ...
Sampisa's user avatar
  • 1,593
1 vote
1 answer
122 views

I've been trying to figure out a way to provide some extra information to my priority queue's compare function. Let's assume I have the following: class MyClass { class IntCompare { ...
dwnenr's user avatar
  • 575
0 votes
0 answers
75 views

import java.util.LinkedList; import java.util.Queue; import java.util.Random; public class TestQueueTwo { public static void main(String[] args) { Random random = new Random(); ...
Henrique de Liz's user avatar
0 votes
0 answers
32 views

i've tried a multitude of solutions including changing the way that insertThenNext deals with the numbers but all possible solutions i've tried end up making the code fail the other tests that it must ...
Liberosis's user avatar
0 votes
0 answers
62 views

Say I have a custom class as below class Emp { String name; Integer id; } I decide to use a PriorityQueue in java to insert the elements of Emp and provide a custom comparator on id field of ...
curiousengineer's user avatar
-1 votes
1 answer
156 views

I'm trying to implement an A*-like algorithm, and I am having trouble implementing key decrease using the STL priority_queue container. I am trying to reinsert elements into the queue when I decrease ...
Ender_The_Xenocide's user avatar
0 votes
1 answer
139 views

I am trying to implement A* algorithm using pri_que by leveraging python library heapq. In general, all the state of will be stored as a Node instance class Node: def __init__(self, state, parent, ...
Rieder's user avatar
  • 1,505
0 votes
0 answers
29 views

I'm working on merging K linked list using pq. But the comparator not working for all the elements in the Linked list. someone please shed the light why the comparator not working as expected. This ...
BEPP's user avatar
  • 985

1
2 3 4 5
53