You are not logged in. Please login at to post your questions!



I have mapped the indices of sorted elements with the original array using HashMap. The time complexity of my solution is O(logn) for type 1 and 2 queries.
And for type 3 queries its O(n+logn)
I am only using an array,not a segment tree.
Can anyone explain the O(nlogn+ q*log^2n) approach and the O(nlogn+ q*logn) approach? The solution I posted is taking 9.89 secs on the worst case input of 499999 queries of type 3 and 1 query of type 2.

asked 10 Jan '15, 14:45

abeyaar's gravatar image

accept rate: 30%

edited 19 Jan '15, 16:04

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 10 Jan '15, 14:45

question was seen: 3,474 times

last updated: 19 Jan '15, 16:04