Questions tagged [rmq]

Given an array A[1,n] of n objects taken from a well-ordered set (such as numbers), a Range Minimum Query (or RMQ) from i to j asks for the position of a minimum element in the sub-array A[i,j].

Given an array A[1,n] of n objects taken from a well-ordered set (such as numbers), a Range Minimum Query (or RMQ) from i to j asks for the position of a minimum element in the sub-array A[i,j].

More info: Wikipedia

67 questions
1
vote
1 answer

Range Minimum Query - Clojure

I'm working on a Clojure project that takes as an input an array a, and finds the minimum in the range [i,j] for each i, j, in O(n) preproccessing, and O(1) for each query. (preproccessing takes O(n*log(n)), but by using concurrency (pmap) and…
Howaida Khoureieh
  • 519
  • 2
  • 11
  • 24
1
vote
1 answer

Range Minimum/ Maximum Query

I have coordinate points (x,y) say I have 10 000 points . now when a new point is given as test query say (p,q). I have to check with every point in coordinate points.if x coordinate of text query that is P Y from online searches I came…
Nichole Grace
  • 213
  • 1
  • 2
  • 11
1
vote
2 answers

Reply timeout when using AsyncRabbitTemplate::sendAndReceive - RabbitMQ

I recently changed from using a standard Rabbit Template, in my Spring Boot application, to using an Async Rabbit Template. In the process, I switched from the standard send method to using the sendAndReceive method. Making this change does not…
1
vote
1 answer

Reversing a sequence of cyclic shifts

Here's the problem I have a hard time solving. You are given a ciphertext Y and a sequence of cyclic shifts that had produced Y from string Z, the shift with parameters (i, j, k) applies to the substring Z[i..j] (from i-th to j-th character,…
1
vote
1 answer

What is the logic behind calculating minimum queries in static arrays?

I was reading about static array queries and this is what I found: Minimum Queries: There is an O(nlogn) time preprocessing method after which we can answer any minimum query in O(1) time. The idea is to precalculate all values of min(a, b) where…
1
vote
1 answer

Number of elements less than 'x' in a range (l, r) both inclusive

Given an array of integers, and there is a single type of query. Query - (L, R, X) Find the elements less than 'X' in the range (L, R) both inclusive. PS: all the queries are provided before hand i.e. we need to devise an offline algorithm to answer…
Ajay Singh
  • 161
  • 1
  • 1
  • 8
1
vote
0 answers

Extending LCA solution from tree to DAGs

I'm using the algorithm that solves LCA in a tree using RMQ. It basically works like this: We perform an Euler tour on the tree, getting 3 arrays E = {0,1,0,2,0} //the vertexes in the order they were visited L = {0,1,0,1,0} //the levels of each…
Daniel
  • 7,357
  • 7
  • 32
  • 84
1
vote
1 answer

Rabbit mq error: Getting Exception in thread "main" java.io.IOException Caused by: com.rabbitmq.client.ShutdownSignalException

Here is the error I get when I run my main. I do not really understand why it is having as issue with line 44: channel.basicConsume(Q,true,consumer); My goal here is to try and store the messages received into a variable that I can use in other…
Jas
  • 53
  • 1
  • 9
1
vote
1 answer

Range minimum query, dynamic array, interval tree, treap

I need an algorithm with some data structure in Python that at every step when two new elements e1, e2 are given: finds the insertion positions (conserving the order) of the first and the second given elements. finds the maximum value of the…
David
  • 33
  • 4
1
vote
1 answer

Improve the complexity of Update method in Range Minimum Query Using Square Root Decomposition Technique

https://www.hackerearth.com/practice/data-structures/advanced-data-structures/segment-trees/practice-problems/algorithm/range-minimum-query/description/ I am trying to solve this question. I am making the vector size of…
Brij Raj Kishore
  • 1,595
  • 1
  • 11
  • 24
1
vote
1 answer

Moving window RMQ performance improvement

Say I have an array of integers A of length N, also I have an integer L <= N. What I am trying to find is the minimum of the range [0, L-1], [1,L], [2,L+1]....[N-L,N-1] (like a moving window of length L from left to right) My algorithm now is O(N…
shole
  • 4,046
  • 2
  • 29
  • 69
1
vote
2 answers

RMQ on static 2D array in constant time

The input is an array (n*m 1
Rajarshi basu
  • 330
  • 1
  • 10
1
vote
3 answers

Do I need rabbitmq bindings for direct exchange?

I have a rabbit mq server running, with one direct exchange which all my messages go through. The messages are routed to individual non-permanent queues (they may last a couple hours). I just started reading about queue bindings to exchanges and am…
tuck
  • 452
  • 5
  • 15
1
vote
1 answer

Range minimum query and update for intervals

I need a range minimum query data structure that supports three operations:  - initialize with array A[n]  - update(i,j,v) - add v to all elements from the range A[i]...A[j]  - query (i,j) - find the minimal element from the range A[i]...A[j] Both…
mr-fotev
  • 177
  • 4
1
vote
1 answer

Getting WA in ANUGCD from Codechef March Long Contest

I am Getting WA in the Question GCD Condition from Codechef March Long Contest. Kindly tell me what I've done wrong or some test case where the code produces Wrong answer. Link for the Question I Have used RMQ(Range maximum Query) for every prime…
Dhruv Chandhok
  • 780
  • 7
  • 18