Comments (6)
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.
@Ritik-7 you should guide people who want to resolve this bug
from cp-dictionary.
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.
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.
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.
@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)
- Add Code for Grid Path problem
- Use case ideas and discussion. HOT 2
- Added code for matrix multiplication
- Add code for multi source BFS HOT 3
- Add Code for Multi source Dijkstra HOT 1
- Sieve Of Eratosthenes HOT 1
- Add codes in different languages HOT 21
- Scrambled Strings HOT 2
- Mention the runtime of algorithms in their respective files HOT 2
- Improve readme.md HOT 1
- Set up github actions for checking whether the code compiles or not HOT 5
- Add cpp code for insertion sort.
- .class file is not being ignored HOT 1
- BitonicSort using python
- add algorithms in C language
- Write code for Moore's Voting Algorithm
- Modifying File Structure
- [feat] add sliding window and two pointer algorithm HOT 1
- [feat] add Rabin-Karp and KMP Algorithms HOT 1
- Testing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cp-dictionary.