{"id":1257,"date":"2026-06-01T16:23:28","date_gmt":"2026-06-01T13:23:28","guid":{"rendered":"https:\/\/www.juustila.com\/antti\/?p=1257"},"modified":"2026-06-01T16:23:30","modified_gmt":"2026-06-01T13:23:30","slug":"preparing-for-dsa-course-in-fall-2026","status":"publish","type":"post","link":"https:\/\/www.juustila.com\/antti\/2026\/06\/01\/preparing-for-dsa-course-in-fall-2026\/","title":{"rendered":"Preparing for DSA course in Fall 2026"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I&#8217;ve been working on modifications to the Data Structures and Algorithms (DSA) course during this Spring. This is another attempt to make it more possible than before to pass the course for more students than in the past. (A complicated way to say that I am trying to make it easier to pass the course.)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The last programming task on Graphs has previously included implementing the basic graph features (adding vertices and edges) as well as basic algorithms (breadth and depth first searches) and finally Dijkstra&#8217;s shortest path algorithm.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next course implementation gives the students <em>already implemented<\/em> Directed and Undirected Graph implementations with necessary algorithms. I&#8217;ll give the implementations as an obfuscated jar file though, not source code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Instead of implementing the mentioned algorithms, they&#8217;ll <em>use<\/em> the given algorithms to <em>solve problems<\/em>. Let&#8217;s see if this helps in growing the pass percentage of the course.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The use case story in the new graph programming task is such that&#8230;:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">&#8220;The Finns have grown frustrated to the way things are heading on Earth and have decided to leave the planet, to conquer a little piece of the Galaxy for themselves. Finns have mapped an area of stars and are now planning and budgeting how many portals between pairs of stars they need to build to enable traveling between stars in this little system of theirs.&#8221;<\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">Since the Finns are lead by someone from <a href=\"https:\/\/en.wikipedia.org\/wiki\/Laihia\">Laihia<\/a> (the Scotland of Finland), everything must be done <em>as cheaply as possible<\/em>. So the first problem is to calculate the distances between all the stars, pair at a time, and then arrange them so that the closest pairs are first. Because then the portals are built so that the closest pair of two stars is connected first, then the second closest, etc. This makes building cheaper since not only the two portals needed have a cost, but the cost of maintaining the connection increases as the distance between the stars grow. To maintain the portal connection over longer distances requires more energy, as you can surely understand.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The leader has also set a limit on the number of portals to use in the first phase of conquest. After all the available portals have been used, leader wants to know how many <em>disconnected<\/em> areas we still have left. One can travel within a connected area, but one cannot travel from a connected area to another area of connected stars, as there is no portal connection between them. As you can see from the image below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"932\" height=\"612\" src=\"https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.04.56.png\" alt=\"\" class=\"wp-image-1258\" srcset=\"https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.04.56.png 932w, https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.04.56-300x197.png 300w, https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.04.56-768x504.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption class=\"wp-element-caption\">A map of the star system displaying connected areas of stars where one could travel from a star to another within the connected area. Still there are disconnected areas one cannot travel to from other areas.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Finns could then build more portals and continue to connect the still unconnected stars from the list of stars in increasing distance order. But that would create connections that are not actually needed for traveling. As you can see from the image above, connected areas contain links between stars that are <em>redundant<\/em> &#8212; one could travel from a star to another using other available connections. So to the disappointment to the leader, we have spent portals and energy to maintain connections not actually needed!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The leader then decides that the disconnected areas should be connected with only one additional portal pair to one other connected area <em>as close as possible<\/em>. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Taking first the largest connected area A (having more stars than other connected areas) should be connected to another connected area B that has a star that is nearest to some star in A than any other of the connected areas C, D, E,&#8230; has.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, if you take a look at the image above, and the connected area at the bottom right corner. It could be connected to the area that is above and left, since it seems to be the nearest. Or the triangular area in middle left edge should be connected to the one on the right of it &#8212; they are closest to each other.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To enable this, one must first obtain all the disconnected areas and sort them largest first, in descending order by the count of stars in the connected area. Then starting to find the closest areas to connect and do the actual <em>connecting<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">There are many ways to do this, but one is to create a minimum spanning tree forest of the graph. Minimum spanning tree has only the necessary links, stripping the redundant ones, but at this point Finns are not interested in that, just the fact that the forest has trees and these trees are disconnected.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using these disconnected trees, Finns can find the two closest connected areas and add only two portals between two closest stars of area A and B. This connects the two disconnected areas to one larger connected area. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This connecting happens with the original first phase task graph with redundant portals and links, not with the minimum spanning tree forest. Why not with that? <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since dismantling the already built portals also has a cost. Those pesky portal builders get paid not only building things but also from dismantling things. And as the stingy Laihian leader of Finns sees an opportunity to save costs, that opportunity surely will be taken.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"958\" height=\"632\" src=\"https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.34.04.png\" alt=\"\" class=\"wp-image-1262\" srcset=\"https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.34.04.png 958w, https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.34.04-300x198.png 300w, https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.34.04-768x507.png 768w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 1362px) 62vw, 840px\" \/><figcaption class=\"wp-element-caption\">Additional portals (connected by green lines) are built to connect closest disconnected areas to each other. <\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">After doing this, the whole star system should be connected. That is, you can travel from any star to another star, since there always is a path. Finns can now start counting the beans of traveling from star P to star Q. This can be done using Dijkstra&#8217;s shortest path algorithm. Some sample travel costs are then calculated.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"646\" height=\"748\" src=\"https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.37.08.png\" alt=\"\" class=\"wp-image-1263\" srcset=\"https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.37.08.png 646w, https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.37.08-259x300.png 259w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><figcaption class=\"wp-element-caption\">A sample travel path has been calculated between two stars. A path was found, and as you can see, the shortest path from alternative links in areas with redundant connections was selected.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The final task is to try to see if dismantling the redundant portals and links that are not actually needed (see the image again), has a cost advantage. Could Finns <em>sell<\/em> those portals to someone else with <em>profit<\/em> and still be able to travel cheaply enough in their system or not? Note that even though the extra portals and connections have a cost, they also may provide shorter routes to travel, thus reducing the travel costs, compared to having only the minimum number of portals\/connections.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">At this point the whole system is connected, so Finns can again create a minimum spanning tree forest from the graph. This time the forest has only one tree, since there was no disconnected areas. This tree now replaces the original star map graph and we can calculate the costs of traveling having only the bare minimum of connections that are needed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"628\" height=\"846\" src=\"https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.37.22.png\" alt=\"\" class=\"wp-image-1264\" srcset=\"https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.37.22.png 628w, https:\/\/www.juustila.com\/antti\/wp-content\/uploads\/2026\/06\/Nayttokuva-2026-06-01-kello-15.37.22-223x300.png 223w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><figcaption class=\"wp-element-caption\">This starmap has redundant connections removed. Only the connections needed to keep the whole star system connected have been retained. A path can still be found between any two stars, but the cost of traveling may change compared to the previous situation.<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In the end, the task is to see what if the total cost of building portals with some redundancy is cheaper compared to stripping away all redundant connections. In the evaluation, Finns need to calculate both the total cost of building and maintaining the portals, as well as traveling through the system via the shortest paths, either with redundancy or no redundancy at all.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I&#8217;ve implemented an example solution for the problems to see that the problems are solvable by the students, and so that I can then assist the student in actually solving the problem. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <a href=\"https:\/\/youtu.be\/20R3ukNhV_A?si=mXQSYvdscLjvT9vU\" data-type=\"link\" data-id=\"https:\/\/youtu.be\/20R3ukNhV_A?si=mXQSYvdscLjvT9vU\">video below<\/a> visualizes in an animation how the different problems are solved. First, the tasks are solved one by one with a small sample star map. After this, a larger star map with 10\u00a0000 stars is selected and all tasks are solved in one go.<\/p>\n\n\n\n<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/20R3ukNhV_A?si=6gdZxSl6MPXr2e_a\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n\n\n\n<p class=\"wp-block-paragraph\">The learning goals include forming combinations of two of all the stars, calculating distances between them, sorting by distance, selecting a graph implementation (directed or undirected, easy peasy), adding vertices and edges to a graph, forming minimum spanning trees, merging graphs, and then doing searches for shortest paths. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Obviously making sure all is done correctly. Each student will use their own star map file the tools generate to them, and the tests will verify that their result is correct with their specific star map file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Still WIP, have to make sure everything is easily packaged as a learning task with instructions. And automatically testable with JUnit. Teaching resources are (once again, surprise surprise \/s) less than previous years, I have (once again) more work allocated than before, so automation in evaluation and support for independent work for students is <em>really truly<\/em> needed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been working on modifications to the Data Structures and Algorithms (DSA) course during this Spring. This is another attempt to make it more possible than before to pass the course for more students than in the past. (A complicated way to say that I am trying to make it easier to pass the course.) &hellip; <a href=\"https:\/\/www.juustila.com\/antti\/2026\/06\/01\/preparing-for-dsa-course-in-fall-2026\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Preparing for DSA course in Fall 2026&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[2],"tags":[48,60,151,77,70,12],"class_list":["post-1257","post","type-post","status-publish","format-standard","hentry","category-coding","tag-algorithms","tag-data-structures","tag-graph","tag-java","tag-programming","tag-teaching"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/posts\/1257","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/comments?post=1257"}],"version-history":[{"count":16,"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/posts\/1257\/revisions"}],"predecessor-version":[{"id":1280,"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/posts\/1257\/revisions\/1280"}],"wp:attachment":[{"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/media?parent=1257"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/categories?post=1257"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.juustila.com\/antti\/wp-json\/wp\/v2\/tags?post=1257"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}