alphacyberranger@sh.itjust.works to Programmer Humor@programming.devEnglish · 2 months agoO of what nowsh.itjust.worksimagemessage-square18fedilinkarrow-up1194arrow-down15
arrow-up1189arrow-down1imageO of what nowsh.itjust.worksalphacyberranger@sh.itjust.works to Programmer Humor@programming.devEnglish · 2 months agomessage-square18fedilink
minus-squareVenator@lemmy.nzlinkfedilinkarrow-up1·edit-22 months agoWhy would you want a specific time complexity? Wouldn’t it be better if it’s faster? /s
minus-squareJaddedFauceet@lemmy.worldlinkfedilinkarrow-up5·2 months agoLikely they want a lower time complexity. for example a question can be trivially solved in O(n^2). but there is no know < O(n) solution, so they ask for O(n)
minus-squareTiefling IRL@lemmy.blahaj.zonelinkfedilinkarrow-up2·edit-22 months agoMost of the time O(n^2) is optimized to O(n log n). You’ll get some sort of award if you can figure out a sorting function that runs in O(n).
Why would you want a specific time complexity? Wouldn’t it be better if it’s faster? /s
Likely they want a lower time complexity.
for example a question can be trivially solved in O(n^2). but there is no know < O(n) solution, so they ask for O(n)
Most of the time O(n^2) is optimized to O(n log n). You’ll get some sort of award if you can figure out a sorting function that runs in O(n).