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
0
votes
1 answer

What is the fastest algorithm for this kind of RMQ?

I am doing a task using the following algorithm (pseudo code) int A = [] int C = { ... } // N non-negative integers int R = { ... } // N non-negative integers for(i = 0 to N){ // Let j in range [i-R[i], i-1] A[i] = Minimum of ( A[j] + C[j]…
shole
  • 4,046
  • 2
  • 29
  • 69
0
votes
1 answer

Wrong Answer - Unable To Find Bug - Range Minimum Query Using Segment Trees

I am trying to learn segment tree through https://www.topcoder.com/community/data-science/data-science-tutorials/range-minimum-query-and-lowest-common-ancestor/ After Understanding the basics of segment trees I tried to solve this question. But…
Brij Raj Kishore
  • 1,595
  • 1
  • 11
  • 24
0
votes
1 answer

Why getting tle in this Range Minimum Query code?

I was trying to solve a very basic problem that just involved the implementation of Range Minimum Query.The link for the problem is https://www.hackerearth.com/practice/data-structures/advanced-data-structures/segment-trees/tutorial/ But I am…
Gaurav Jha
  • 161
  • 1
  • 7
0
votes
1 answer

RMQ using two fenwick trees (binary indexed tree)

Based on this paper, I found that it is quite brilliant to use two BITs to do RMQ in O(lg N), as it is easier to code than segment tree, and the paper claims it performs better than other data structures as well. I understand how to build the tree…
shole
  • 4,046
  • 2
  • 29
  • 69
0
votes
1 answer

Bug in RMQ Segment Tree

I am trying to build a Segment Tree for performing RMQ. Somehow, no matter what range I query it will return me 0. For example, my array is [ 1,2,3,4,5,6,7,8,9,10 ]. RMQ from index 3 to 5 should give 4. But my code keeps outputting 0. My…
Donald
  • 1,300
  • 2
  • 13
  • 29
0
votes
0 answers

Number of queries on array

I am looking at Range minimum queries. Wikipedia says : There are Θ(n²) possible queries for a length-n array. I do not understand that. Here is an example for an array of size 5. The following queries are possible : 1 query [0,4] 2 queries…
sam walt
  • 1
  • 2
0
votes
1 answer

Update one item in segment tree

A part of a problem I'm solving involves getting the minimum in a range of an array (RMQ), so I implemented a segment tree and it works fine so far. Then I want to update one item in the original array (There are no updates with more than one) and…
Ayman El Temsahi
  • 2,600
  • 2
  • 17
  • 27
0
votes
1 answer

message does not show up on RMQ when sent from iPhone device while Xcode does

I have an Objective C provider that submits messages to an exchange on a remote RMQ server. I have a consumer listening on a queue bind to that exchange. I am using fanout. when running the application from Xcode all is working well, the message is…
0
votes
1 answer

"Linker command failed with exit code 1" message when building project after adding RMQClient framework to XCODe 7.3 Project

I am trying to add RMQClient framework to my XCODE 7.3 project. I am following the steps as specified in https://github.com/rabbitmq/rabbitmq-objc-client as well as in the RabbitMQ official site. After adding the framework and running Tools->Build I…
0
votes
1 answer

Range minimum query on array

I have N integers Ai defined as A1, A2, ..., AN. I have to handle Q queries of form a. For each such query, find an index i such that Ai ≥ a. And I have to minimise the difference Ai-a. I have done it like while(q--) { cin>>a; …
0
votes
1 answer

Range minimum Query

This is rmq using segment tree. But i am not getting correct output can anybody tell me where i am wrong. ` #include #include #define inf 1e9 using namespace std; int get_mid(int a,int b){ return a+(b-a)/2; } int min(int a,int…
Rajat Sharma
  • 47
  • 1
  • 15
0
votes
1 answer

List containing which servers connects to specific queue

Im new to rabbit MQ and I already know how to list queues and work with the basic functions, but I don't know if there is a way to list the specific servers/ip's that connect to a specific queue, e.g. rabbitmqctl [Search_Specific_ip]…
0
votes
1 answer

What is good practice to strore application config at RabbitMQ queue?

There is a set of same listeners that listens TCP ports and publishes received data to RabbitMQ queue. I need to have ability to configure listeners from backend at other side of the queue. There is no other connection to listeners except RMQ. What…
host.13
  • 108
  • 1
  • 1
  • 11
0
votes
1 answer

Position a view in relation to another view using RMQ

I begin today to use RMQ for my RubyMotion project. I read the documentation of the frame / grid system but I cannot find a way to position a view related to another view. I have 4 UIbuttons with an image inside. I want to place a UILabel under…
Roberto Pezzali
  • 2,484
  • 2
  • 27
  • 56
0
votes
1 answer

segment tree range minimum query

I am trying to understand segment trees. This is a great tutorial that shows how to find a minimum in range. However, it is said there that "All levels of the constructed segment tree will be completely filled except the last level. Also, the tree…
Bob
  • 10,427
  • 24
  • 63
  • 71