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

×

reduce loop

0
1

Can any one tell me how we can reduce loops except using recurssion .. if I'm getting O(n^3) how can we reduce it. In C,C++,JAVA

asked 25 Sep '17, 21:02

sumit098's gravatar image

1★sumit098
1
accept rate: 0%


It depends upon the problem . Moreover it is not always necessary to reduce the complexity . It may be possible for that type of problem to have the best solution of complexity O(n^3) . It may also be possible that the problem setter intends you to solve with this complexity and do so , he set up the test cases low enough .

link

answered 25 Sep '17, 21:18

trashmaster's gravatar image

2★trashmaster
98619
accept rate: 12%

thanks.. bt.. if we get test case and 2D array problem.. how will you do this in O(n^2). some time I need this to set it to O(n^2) instead of O(n^3). so pls tell me any possible way.

(26 Sep '17, 20:06) sumit0981★

As I said before , it depends upon question . A complete search algorithm is sometimes what is needed . If you provide the question , may be I can help .

(26 Sep '17, 21:31) trashmaster2★
toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×42
×36
×20
×1

question asked: 25 Sep '17, 21:02

question was seen: 270 times

last updated: 26 Sep '17, 21:31