Jump to content


Check out our Community Blogs

sensationality

Member Since 18 Mar 2011
Offline Last Active Mar 27 2011 03:33 PM
-----

Posts I've Made

In Topic: Need help with logic in my program

20 March 2011 - 11:53 AM

Thank you so much for your help.

I used merge sort after getting the new location for each element in my list. After sorting it with merge sort I was able to get a transpose.

Thanks again for the help gregwarner!

In Topic: Need help with logic in my program

18 March 2011 - 08:51 AM

Thanks a lot for your reply. That function indeed works (as I have tested with a few test cases), and I was trying to come up with something similar for quite a while. Thanks for the assistance.

Well, now I can get the new position of the elements in the list. However, the following is my concern now: Once I get the new position, in order to put the value in the new position, I would have to create another pointer and transverse the list accordingly. However, this would lead to O(s^2) run time. The assignment specification says:

"Method transpose must have running time O(s log s), where s is the number of
nonzero elements in the matrix"

Would there be any way to do this in O(s log s) time? This is why I was thinking you would to recursively switch the list.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download