Git Product home page Git Product logo

Comments (6)

jerryxu158 avatar jerryxu158 commented on July 26, 2024 1

the version I committed should be incapable of going infinite due to it being a for loop with no nested loop.
In regards to an exit condition regarding visiting the same value, I don't think that would be an issue regarding this variation since it would either catch a repeat twice in a row, as 37|37|... by returning false when the value isn't larger than the one before. or it would be a break in logic if a value is repeated later down the line since the value repeated would have to be smaller than a former value.

from cp-dictionary.

vishalvibes avatar vishalvibes commented on July 26, 2024

@Ritik-7 you should guide people who want to resolve this bug

from cp-dictionary.

tusharjain0022 avatar tusharjain0022 commented on July 26, 2024

I would like to solve this issue. May I start working on this ?
Note: My approach will be to define another function bool isSorted(array address , size of array) that will return true if array is sorted and false if not in O(N) time complexity and will exit or continue according to that. Or any suggestions for me?

from cp-dictionary.

vishalvibes avatar vishalvibes commented on July 26, 2024

This checking takes O(N) time...Is there any better way to avoid TLE even if the array is not sorted?
I have a simple solution that if the process takes more than log2(N) time then return

I would like to know whether there is a better solution to this

from cp-dictionary.

jerryxu158 avatar jerryxu158 commented on July 26, 2024

I would also like to solve this issue, also, what does TLE mean

Edit: I'm trying to see if I can do sub o(n) time, although not entirely sure how to do that since to ensure the array is sorted I'm fairly certain we must visit every value at least once. I'm just going to commit an o(n) version first and get something temporary in while I try and see if there is a way to realistically shorten it

from cp-dictionary.

vishalvibes avatar vishalvibes commented on July 26, 2024

@jerryxu158 true we can't check whether it's sorted or not O(N)...however we can avoid the execution from going into infinite loop...can we do something like if it visits the same element again...then exit?

from cp-dictionary.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.