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 8687317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:05:29+00:00 2026-06-12T23:05:29+00:00

I can probably figure out part b if you can help me do part

  • 0

I can probably figure out part b if you can help me do part a. I’ve been looking at this and similar problems all day, and I’m just having problems grasping what to do with nested loops. For the first loop there are n iterations, for the second there are n-1, and for the third there are n-1.. Am I thinking about this correctly?

Consider the following algorithm,
which takes as input a sequence of n integers a1, a2, …, an
and produces as output a matrix M = {mij}
where mij is the minimum term
in the sequence of integers ai, a + 1, …, aj for j >= i and mij = 0 otherwise.

initialize M so that mij = ai if j >= i and mij = 0

for i:=1 to n do
    for j:=i+1 to n do
        for k:=i+1 to j do
            m[i][j] := min(m[i][j], a[k])
        end
    end
end
return M = {m[i][j]}

(a) Show that this algorithm uses Big-O(n^3) comparisons to compute the matrix M.
(b) Show that this algorithm uses Big-Omega(n^3) comparisons to compute the matrix M.

Using this face and part (a), conclude that the algorithm uses Big-theta(n^3) comparisons.

  • 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-12T23:05:30+00:00Added an answer on June 12, 2026 at 11:05 pm

    In part A, you need to find an upper bound for the number of min ops.

    In order to do so, it is clear that the above algorithm has less min ops then the following:

    for i=1 to n
      for j=1 to n //bigger range then your algorithm
        for k=1 to n //bigger range then your algorithm
            (something with min)
    

    The above has exactly n^3 min ops – thus in your algorithm, there are less then n^3 min ops.

    From this we can conclude: #minOps <= 1 * n^3 (for each n > 10, where 10 is arbitrary).

    By definition of Big-O, this means the algorithm is O(n^3)

    You said you can figure B alone, so I’ll let you try it 🙂


    hint: the middle loop has more iterations then for j=i+1 to n/2

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

Sidebar

Related Questions

This is probably really easy but I can't seem to figure out how to
This is probably a simple question but I can't seem to figure out how
This is probably pretty simple, but I can't figure out how to do it:
This is probably a simple one but I can't seem to figure it out.
This is probably going to be a really simple fix... I just can't figure
this has been bugging me for ages now but i can't figure it out..
It's probably because I haven't been getting enough sleep, but I just can't figure
I know this is probably a really amateur question, but I can't figure this
I've been wrecking myself trying to figure out what is going on with this
I have been trying for a few days now to figure this out -

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.