A. Student management system is a project that have a many function like • Adding student using linked list Student linked list items (name , department , number of registered courses , pointer to linked list of students courses , pointer to next students) • Adding student subject grades as a branched linked list from students which contain (subject name , total ,grade , point )
print student ,subject ,grades
I. In-place merge two sorted arrays Given two sorted arrays X[] and Y[] of size m and n each, merge elements of X[] with elements of array Y[] by maintaining the sorted order. i.e. fill X[] with first m smallest elements and fill Y[] with remaining elements. The conversion should be done in-place and without using any other data structure. For example, Input: X[] = { 1, 4, 7, 8, 10 } Y[] = { 2, 3, 9 } Output: X[] = { 1, 2, 3, 4, 7 } Y[] = { 8, 9, 10}. II. Assume you have the following Tree Struct
- Print Tree Write a print method that takes the node which the mirror image of the tree will start from if no parameter is sent to the function the default value will be the root node. You must solve this problem by three different algorithms. (Inorder, Preorder and Postorder) (a) Inorder (Left, Root, Right) : 4 2 5 1 3 (b) Preorder (Root, Left, Right) : 1 2 4 5 3 (c) Postorder (Left, Right, Root) : 4 5 2 3 1 template struct Tree { Tree(const T &v) : value(v), left(NULL), right(NULL) {} T value; Tree *left; Tree *right; };
- Tree Flipping. Write a flip method that takes the node which the mirror image of the tree will start from if no parameter is sent to the function the default value will be the root node. Flip the tree then print the flipped tree. void flip(Tree * t ); Output: print the flipped tree
- Largest Values Find the largest value in each row of this tree. The output should be: [1, 3, 5] In the first row, there is only one vertex, the root with value 1; In the second row, there are two vertices with values 2 and 3, so the largest value is 3; In the third row, there are two vertices with values 4 and 5, so the largest value is 5. void largestValues(Tree * t); note : - There is many possible answers
- Branches Sum Sum encoded values in each path from root to leaf. The output should be: 262 (124 + 125 + 13) Path 1 → 2 → 4 encodes 124 Path 1 → 2 → 5 encodes 125 Path 1 → 3 encodes 13 long branchesSum(Tree * t); int main(){ Tree* t = new Tree(1); Tree* _1_left = new Tree(2); Tree* _1_right = new Tree(3); t->left = _1_left; t->right = _1_right; Tree* _2_left = new Tree(4); Tree* _2_right = new Tree(5); _1_left->left = _2_left; _1_left->right = _2_right; largestValues(t); return 0; } III. Balanced String Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if:
- Open brackets must be closed by the same type of brackets.
- Open brackets must be closed in the correct order. Note that an empty string is also considered valid. Input : exp = “{()}[][{()()}()]” Output : “Balanced” Input : exp = “{(])” Output : "Not Balanced"