PLEASE NOTE: this server,, will be unavailable on Monday 5th December, from 1pm until 4pm.
Web-based programs, such as csmarks, cssubmit, and the help fora, will all be unavailable.
  It's UWAweek 49


This forum is provided to promote discussion amongst students enrolled in CITS3001 Algorithms, Agents and Artificial Intelligence.

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 5 articles in this topic
Showing 5 of 175 articles.
Currently 6 other people reading this forum.

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

Login to reply
3:24pm Wed 17th Aug, ANONYMOUS

hey, is anyone else struggling with lab 2? and if you're not struggling are you an experienced programmer? just trying to figure out if its normal to be struggling with this :/

SVG not supported

Login to reply
5:32pm Wed 17th Aug, George F.

You are not the only one :(((((((((((

SVG not supported

Login to reply
2:08am Thu 18th Aug, Luke G.

So I have a question I want cleared up about Lab 2. I am aware the format of the input is the number of cities followed by the respective x and y axis of each city but what I am struggling to understand is how I even am meant to access this data. My current method is public static int[] tspnn(double[][] table) by default and so the parameters don't really fit. Am I meant to make another method that creates the table and if so what do I call it. Should I call it main(String arg) or something. Also am I meant to return the city number with the shortest length, the shortest length itself or just the path I took in array form.

SVG not supported

Login to reply
10:37am Thu 18th Aug, Ryan B.

This is something that is unclear based on the brief lab description, so do not blame yourself!

  1. The lab will run the tspnn(double[][] table) that you will fill out, with the 2d table provided to it (you don't need to generate it yourself).
  2. That 2d table is generated by (invisible) code elsewhere (by the lab runner code), using the 2d coordinate pairs provided in the 'inputs' that you see down at the bottom when you run the code.

It looks as if the inputs are given to you in case you want to test your code locally (by generating the double[][] table), but for the purpose of the lab you can assume that the input is a 2d table of distances between each city (with table[0][1] the distance between City 0 and City 1).

Hope this helps!

SVG not supported

Login to reply
12:03pm Thu 18th Aug, Mehwish N.

First of all, attempt this question in your IDE first. For testing purpose, populate a table of say 4 or 5 cities and call this function from your main program. Once you are sure that the program is working as expected, you can copy paste the code and moodle and test. In every lab, we have gone through the concept of representing distances in a 2d table, where distance between the cities and symmetric and the distance of a city with itself is zero. Try replicating an example that you solve on the paper.

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  1:17AM Sep 14 2022
Privacy policy