Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8434705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:43:50+00:00 2026-06-10T06:43:50+00:00

I read the wikipedia link on Range Minimum Queries, looked at a couple more

  • 0

I read the wikipedia link on Range Minimum Queries, looked at a couple more tutorials (topcoder and other links) but I have a very basic question:

Formal definitino of RMQ is :
Given an array of objects taken from a well-ordered set (such as numbers), a Range Minimum Query (or RMQ) from to asks for the position of a minimum element in the sub-array .

What I don’t understand is that why can’t we solve the problem by linear search?
In an array A[0…n], if we need RMQ(i,j)

min = A[i]
index = i
for iter=i; iter <j; iter ++
if A[iter] <= min
min = A[iter]
index = iter;

by the end of the loop, we know the min and the index where the min lies.

I am definitely missing something here…can someone help me understand why we need RMQ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:43:51+00:00Added an answer on June 10, 2026 at 6:43 am

    RMQ is meant to solve the problem you describe but way faster then your approach. There are two approaches – a static version where you do some precomputation(the most opitmized version that is really sophisticated takes linear precomputation) and after that answers constantly for each query, and dynamic apporach where you have log(n) time for each query.

    In the static case you can not change the initial array, while in the dynamic it is permitted that its values change in time.

    Note that in both cases you are meant to answer A LOT of queries. This means that answering in constant or logarithmic time will be way faster then your linear approach and thus will work in cases your idea is too slow. Hope this explains the idea.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What exactly is POSIX? I have read the Wikipedia article but I still don't
I have read the Wikipedia article about converting from HSV to RGB , but
I have read the Wikipedia article on JavaFX and several other articles and I
In 2 complements I read from wikipedia, the range is from -128 to 127.
I google'd a bit and read http://en.wikipedia.org/wiki/Portable_Executable but i can't seem to find when
I have read about LDAP on wikipedia and I kind of understand what it
I have read the explanation in http://en.wikipedia.org/wiki/PageRank and i understand that the page rank
I have read in wikipedia that Decorator pattern is used for .Net and Java
I have been in one competition before, and I have looked into another. But
I read the Wikipedia article on scenario testing, but I am sad to say

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.