{"id":4605,"date":"2019-11-07T14:14:14","date_gmt":"2019-11-07T12:14:14","guid":{"rendered":"https:\/\/blue.pri.ee\/ttu\/?page_id=4605"},"modified":"2026-04-23T17:04:26","modified_gmt":"2026-04-23T15:04:26","slug":"homework-iii-variant-hw2-continuation","status":"publish","type":"page","link":"https:\/\/blue.pri.ee\/ttu\/programming-ii\/homework-iii\/homework-iii-variant-hw2-continuation\/","title":{"rendered":"Homework III variant: Abstract data structures"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/blue.pri.ee\/ttu\/programming-ii\/homework-iii\/homework-iii-variant-hw2-continuation\/#Task_description\" >Task description<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/blue.pri.ee\/ttu\/programming-ii\/homework-iii\/homework-iii-variant-hw2-continuation\/#Requirements_for_the_program\" >Requirements for the program<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/blue.pri.ee\/ttu\/programming-ii\/homework-iii\/homework-iii-variant-hw2-continuation\/#Requirements_for_the_standards_and_environment\" >Requirements for the standards and environment<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/blue.pri.ee\/ttu\/programming-ii\/homework-iii\/homework-iii-variant-hw2-continuation\/#Task-specific_requirements\" >Task-specific requirements<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/blue.pri.ee\/ttu\/programming-ii\/homework-iii\/homework-iii-variant-hw2-continuation\/#Documentation\" >Documentation<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/blue.pri.ee\/ttu\/programming-ii\/homework-iii\/homework-iii-variant-hw2-continuation\/#Submitting_your_task\" >Submitting your task<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"Task_description\"><\/span>Task description<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>This variant is based on the existing homework 2 variant. There are additional requirements by adding more complexity from using abstract data structures and additional features.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Requirements_for_the_program\"><\/span>Requirements for the program<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The code must adhere to all of the best practices introduced during Programming 1 and Programming 2.<\/p>\n<p>Your solution can include topics that have not been covered, as long as they are used correctly and well documented. You need to provide motivation why those concepts were used so that it clear, that you have mastered those topics.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Requirements_for_the_standards_and_environment\"><\/span><span id=\"Requirements_for_the_standards_and_environment\" class=\"ez-toc-section\"><\/span>Requirements for the standards and environment<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>The program must be written in the C programming language. You are permitted to use the C90 and C99 standards. Using newer standards (C11, C17, C23) is permitted, if it provides additional value. This must be explained in the report.<\/p>\n<p>In addition to the standard C libraries, you are allowed to use C POSIX and GNU C libraries and extensions. Use of any other third party libraries must be agreed upon separately.<\/p>\n<p>Your program will be compiled and tested in a Linux environment, equivalent to the one in the lab computers (OpenSUSE SLED-15 SP5, using GCC-12) or with the latest Ubuntu version (Ubuntu Linux 25.10, using GCC-15 or later). Compatibility with Windows or MacOS is not required.<\/p>\n<h4><span class=\"ez-toc-section\" id=\"Task-specific_requirements\"><\/span>Task-specific requirements<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>For this task, all requirements for homework 2 apply for both the documentation and the code. In addition, the following has to be done:<\/p>\n<ul>\n<li>All user input must be checked. If the input is incorrect, you must show an error and re-prompt the user. Invalid input format must be handled gracefully (e.g. user enters a string instead of a number).<\/li>\n<li>It must be possible to return from any submenu and action at any time. E.g. if the user accidentally enters deletion of a record, they must be able to return to the previous menu without specifying anything for deletion.<\/li>\n<li data-select-like-a-boss=\"1\">Task should be separated out into multiple .c and .h files in a meaningful way. A Makefile should be included to build the solution.<\/li>\n<li>Must use CSV (comma separated values). In addition, the field itself must be able to allow for the same symbol as is the separator.<\/li>\n<li>You must use a doubly linked list when reading the data file, which only contains a primary key (e.g. movies, books, phones, accounts), to memory. You can change this to use any type of trees, if you feel this will improve your program. In this case the benefit must be documented.<\/li>\n<li>Items for the second data file can be read to the data structure of your choosing that makes sense for the task.\u00a0 It is required that PK-FK relation will be handled by pointers. This means that from any item in the first data structure, you must be able to go directly to the related items in the second data structure by dereferencing a pointer. The association must be done while reading in the data from the files or right after it.\n<ul>\n<li>You can combine multiple accessing methods if this makes sense for your task.<\/li>\n<li>Some ideas:\n<ul>\n<li data-select-like-a-boss=\"1\">A pointer to a linked list<\/li>\n<li data-select-like-a-boss=\"1\">A pointer to a tree<\/li>\n<li data-select-like-a-boss=\"1\">A pointer to a dynamic array of pointers which reference the items.<\/li>\n<li data-select-like-a-boss=\"1\">A pointer to a hash table<\/li>\n<li data-select-like-a-boss=\"1\">&#8230;<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>You must be able to delete any entry from either data structure through the program\n<ul>\n<li>The removal must immediately take place in the program while it&#8217;s still running.<\/li>\n<li>The removed row(s) must also be removed from the file(s), so the next time the program runs, they will not exist any more. This can be done either immediately when deleting or after the user decides to exit the program.<\/li>\n<li>Removal must be done by their respective unique IDs.<\/li>\n<li>Data integrity must be enforced.<br \/>\nThis means that you cannot delete an item from the primary file which still has PK-FK relations to the second file. Once all items have been deleted which have a PK-FK relationship, then the item from the main data structure can be deleted<br \/>\nE.g. If a movie has ratings, the movie cannot be deleted before all of the ratings for that movie have been deleted.<\/li>\n<\/ul>\n<\/li>\n<li>You must be able to add any entry to either file through the program.\n<ul>\n<li>Application must support input that consist of multiple words. Input correctness must be validated (i.e. does it match the expected data type).<\/li>\n<li>The addition must immediately take place in the program while it&#8217;s still running<\/li>\n<li>The added row(s) must also be added to the file(s), so the next time the program runs, they will also be read in. This can be done either immediately when adding or after the user decides to exit the program.<\/li>\n<li>Data integrity must be enforced (E.g. you cannot add ratings to a movie that doesn&#8217;t exist yet).<\/li>\n<li>All fields must be checked to match the format.<\/li>\n<li>The generated ID value must be unique (typically a sequential value). Only in the case of using well-known values such as ISBN codes for books, Estonian ID codes for people, international IBAN numbers for bank accounts etc. can such a number be entered manually while adding entries.<\/li>\n<\/ul>\n<\/li>\n<li>The new functionality must be added to the menu.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Documentation\"><\/span><strong>Documentation<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>All requirements set for the Homework 2 documentation apply. <strong>Extend<\/strong> your current documentation to cover all the updates and improvements from Homework 3.<\/li>\n<li>Visualize the data structure in the files\n<ul>\n<li>Use either UML class diagram or ERD (entity relationship diagram).<\/li>\n<li>Make sure to show data types, primary keys and PK-FK relationship.<\/li>\n<\/ul>\n<\/li>\n<li>Visualize your data structure that you built in the application.<\/li>\n<\/ul>\n<p>Note: Function documentation also a part of the documentation requirement, which must be written into the code. For every function, detail its purpose, parameters, requirements for parameters, return value and possible side effects.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Submitting_your_task\"><\/span>Submitting your task<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>The supervisor for this task is Eeva-Maria T\u0161ernova\u00a0 (Mattermost: @eeva)<span class=\"Username-bWxwir krLrso\">.\u00a0<\/span><\/p>\n<p>Submitting of the homework is in two stages:<\/p>\n<ol>\n<li>Upload your solution to Moodle<\/li>\n<li>Write a message to the task supervisor using their preferred method of contact to let them know that the solution has been uploaded. It\u2019s also recommended to include the solution in the message!<\/li>\n<\/ol>\n<p>You need to submit two files:<\/p>\n<ol>\n<li>The documentation (pdf document)<\/li>\n<li>All necessary files for your project as a .zip archive (source code, data files, Makefile. If necessary, configuration files).<\/li>\n<\/ol>\n<p>The supervisor can ask for an on-site defense of the solution.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Task description This variant is based on the existing homework 2 variant. There are additional requirements by adding more complexity from using abstract data structures and additional features. Requirements for the program The code must adhere to all of the best practices introduced during Programming 1 and Programming 2. Your solution can include topics that &hellip; <a href=\"https:\/\/blue.pri.ee\/ttu\/programming-ii\/homework-iii\/homework-iii-variant-hw2-continuation\/\" class=\"more-link\">Loe edasi <span class=\"screen-reader-text\">Homework III variant: Abstract data structures<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":2569,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"page-templates\/code-width-wide.php","meta":{"footnotes":""},"class_list":["post-4605","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/pages\/4605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/comments?post=4605"}],"version-history":[{"count":7,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/pages\/4605\/revisions"}],"predecessor-version":[{"id":11390,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/pages\/4605\/revisions\/11390"}],"up":[{"embeddable":true,"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/pages\/2569"}],"wp:attachment":[{"href":"https:\/\/blue.pri.ee\/ttu\/wp-json\/wp\/v2\/media?parent=4605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}