It's UWAweek 47

help3001

This forum is provided to promote discussion amongst students enrolled in CITS3001 Advanced Algorithms.

Please consider offering answers and suggestions to help other students! And if you fix a problem by following a suggestion here, it would be great if other interested students could see a short "Great, fixed it!"  followup message.

How do I ask a good question?
Displaying the 2 articles in this topic
Showing 2 of 202 articles.
Currently 13 other people reading this forum.


 UWA week 31 (2nd semester, week 2) ↓
SVG not supported

Login to reply

👍?
helpful
3:11pm Thu 1st Aug, Mahit G.

I am able to get the correct answer however, when it comes to bigger input, my code still takes more than 5 seconds, I think this could be because I'm converting each element in an int first running a loop through it, correct me if I'm wrong.


SVG not supported

Login to reply

👍?
helpful
12:39pm Fri 2nd Aug, Andrew G.

"Mahit Gupta" <23*9*2*5@s*u*e*t*u*a*e*u*a*> wrote:
> I am able to get the correct answer however, when it comes to bigger input, my code still takes more than 5 seconds, I think this could be because I'm converting each element in an int first running a loop through it, correct me if I'm wrong.
Converting the input strings into ints (which is intended), would only take a single linear O(N) scan over the list. It would take this long to even read in the input, so that should not be the dominating factor. Some questions for you to consider that may help you: - How many inversions can there be in the worst case? - If you count inversions one at a time, how long will that take, therefore?

The University of Western Australia

Computer Science and Software Engineering

CRICOS Code: 00126G
Written by [email protected]
Powered by history
Feedback always welcome - it makes our software better!
Last modified  8:08AM Aug 25 2024
Privacy policy