You need to implement the Phonebook class, which is a phonebook. Each directory has an attribute name. Implement the class as doubly connected list, where the nodes of the list in addition to the pointer contain an attribute of type Contact (struct), and that is the structure that consists of a person / company name (string type), a mobile phone (string type, in the form “062123456”) and a landline telephone (also of the string type, in the form “033222555”). It is possible that the contact has a mobile phone, and fixed is not (ie fixed is an empty string), or vice versa, but it is necessary that at least one of them is entered, as and name. Mobile and landline phones can only contain numbers (otherwise an exception is thrown). Elements keep the directory in sorted order by name of person / company. In addition to the things that are necessary for proper functioning of the class (it is not necessary to implement iterators, but it is not forbidden), implement the following functionalities: Functions for adding a new contact, deleting an existing one, renaming a person / company and change of number (mobile or fixed). Keep in mind that contacts must always be in the phonebook in sorted order, and that there should be no duplicates (i.e. two contacts with the same name). If the user tries to add a contact whose name already exists, an exception is thrown. Search by person / company name, where the function does not have to receive the full name, but is possible only part. Eg if the function receives the string “adm”, all contact information should be listed Administration, Admir and Admira (provided, of course, that such exist in the Directory). Order contacts in the search list is sorted by name. Search by phone number (either landline or mobile). Eg if a string search is performed “0626”, the function should list all contacts whose number (either fixed or mobile) starts with that string. Don’t assume which digits the landline can start with and which mobile (because it is possible, for example, for the user to enter incorrectly). The order of contacts in the list The search is sorted by name. A constructor that receives a string (vector) of contacts, but where the contacts do not have to be sorted order. The constructor should take care of sorting the contacts, which should not be duplicates (and there may be a number of them). Also, first add contacts to the phonebook (without sorting), and only sorting needs to be done directly on our list, therefore, contacts are not allowed, for example put them in a row, then sort them, and then return them to our list). It is imperative that time the execution of this constructor is ?? (?? log ??), where ?? is the number of contacts. Function for merging (sorted) directories into a new (sorted) directory. If the directories are velicina and velicina, the function should run at time ?? (?? + ??). In case there are two contacts in the directories with the same names, it is necessary: i. if the contacts are the same (in the sense that they have the same name, mobile phone and landline), only one of them should be in the new directory (ie there should be no duplicates); ii. if the contacts have the same name, they both have a mobile number entered (therefore, it is not empty string), but these numbers are different, then there will be two contacts in the new directory, pri to which the name of the directory is added at the end of the name (eg “Admir – PMF staff” and “Admir – Vladislav Skaric parents ”). We do the same if both have a fixed number, but they are numbers different. iii. if the contacts have the same name, and the same mobile (fixed) phone, but one is registered
fixed (mobile) phone, and not with another, then you should only stay in the new directory that node where both the mobile and the landline phone are registered.