Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make sure your C - code compiles. Any non - compiling code will receive a very low mark.Thepseudocodeto be given in the code as a

Make sure your C-code compiles. Any non-compiling code will receive a very low mark.Thepseudocodeto be given in the code as a comment. This is20%of the marks.Each algorithm is to be associated with aflowchartin pdf. This is30%of the marks.Submit the code file as .c and the flowchart as .pdf files.Do not make .zip or .rar files. Upload them as separate files. Those who uploadcompressed file like .zip or .rarwill get zero mark.Question : Merging DictionariesThis project is a continuation of Project 1. However, you do not need all the codes fromProject 1. Assume that from Project 1, you have the function that deletes and inserts anelement into a dictionary (Please refer to Project 1 file for more info). Assume that thesefunctions are implemented as DeleteElement, InsertElement and UpdateElement, where ineach case the functions take an array name and the dictionary value.For this project, we want you to merge two dictionaries. Assume that two dictionaries aregiven to you. Here you will implement three algorithms. All three algorithms to be im-plemented via a function, where the function takes three arrays and their StartingIndex asparameters.Algorithm 1(15 Points): Take one dictionary, and insert the elements of the other dictionaryone-by-one by uisng the InsertElement function (If you have implemented this function inProject 1 you can use it here, otherwise, just provide the function call via prototyping).1
Algorithm 2(15 Points): Get the StartingIndex for both arrays and make another arraywith the size equal to the total size of both dictionaries to be merged. Then, by comparingthe dictionary values at the startingIndex for both arrays, insert the elements to the thirdarray in a sorted manner until all the elements from both arrays are transferred to the thirdarray.Algorithm 3(50 Points): Balanced Binary Search Tree Merge Description: This algorithminvolves using a balanced binary search tree (BST) to merge two dictionaries. Each dictio-nary is first converted into a balanced BST (if not already), and then one tree is merged intothe other by inserting all its elements. This ensures that the final tree remains balanced,preserving optimal access times.After you implement the algorithms, provide a complexity analysis for all three algorithmsand determine the efficient algorithm in terms of time and space usage.(20 Points)You can make any other necessary assumptions.You should print the content of the arrays to indicate that the merging is done success-fully

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

ISBN: 0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

Are there countries that allow naked shorting

Answered: 1 week ago

Question

What is human nature?

Answered: 1 week ago