Learning Goal: I’m working on a algorithms & data structures question and need an explanation and answer to help me learn.Task: make the program run on your computer. Understand the logic of functions.
Make changes in the program to sort data in descending order by mergesort and quicksort.
Declare a list object D of size 50 and try your program on this object.
Requirements: as long as you want | .doc file | C++
Learning Goal: I’m working on a algorithms & data structures exercise and need an explanation and answer to help me learn.In Assignment 9, you wrote the Map ADT similarly to the std::map, but the underlying tree is notbalanced. To guarantee O(logN) performance, you must upgrade the BST into an AVL tree.You need to create a header file, map.h, based on Assignment 9 and according to your currentimplementation. The public interface of the Map container must remain the same as in Assignment 9,with only one exception: the erase() method is not required. Meanwhile, other Map operations, suchas the constructors and destructor, the one-directional Map iterator, operator, must all be supported.The Map container must be generic and implemented as a class template, so it can be instantiated asMap<:string int="">, for example. You may add other methods as you see fit.Make sure you keep the overloaded operator << and printTree() methods provided in the map.cpp fileunchanged, in order for the graders to verify your results. A good starting point for this assignment isto take what you did for Assignment 9P, add pieces from Lab 9 where you had a simple AVL treewritten under the hood of a Set ADT, and make some modifications for threads in the rotation/heightcode.To test your program, you can reuse the test cases for Assignment 9, excluding the tests for erase()method. You should check the tree printout and verify the AVL tree is correct.Note that the std::map() container can only be used as in the starter code of Assignment 9. Otherusages of STL containers are not allowed. In addition, you must implement an AVL tree in thisassignment, not any other types of balanced search tree (for example, a Red-Black tree).
Learning Goal: I’m working on a algorithms & data structures question and need an explanation and answer to help me learn. The warehouse of an e-commerce company has limited stock available for
each item due to a promotional sale. The company needs to distribute
this stock to its distribution center in a particular manner. If the
value of the available stock for an item is an even number, then the
total stock is divided by 2. If it is an odd number, 1 is subtracted
from it. The company wishes to know how many distributions can take
place before the stock reaches 0. Write an algorithm to calculate the
number of distributions that can take place before the stock reaches 0.
Input The input consists of an integer -num Stocks, representing the
stock available for the item (N)