1. Write a function that returns the result (int) of an expression passed as a character array (char*). Example: "324 + 5 * 7 * 2 + 45 + 3 * 2". The facilitating circumstance is that only addition and multiplication operations can be found in the expression. Also, there are no parentheses in the expression. Essentially, only digits, +, and * can be found, and as far as I remember, there is a space between each number and operation. 2. A doubly linked list is given. Write a function that, as input, receives a pointer to the first element (Elem* head) and modifies the list in the following way: element(1) – element(n) – element(2) – element(n-1) – element(3) – element(n-2), etc. The output of the function is a pointer to the first element of the list (Elem* head). 3. Write a function that returns the longest path between two nodes in a tree (the number of nodes on the path between the two farthest nodes). The input of the function is a pointer to the root of the tree (Node* root), and the output is an integer (int). 4. Given a coordinate system with four quadrants marked, write a function that takes as input the coordinates of two points (float x1, float y1, float x2, float y2) representing the endpoints of a line segment. The function should return an output (int) that provides information about which quadrants the line passes through. The output is of type integer and is obtained as follows: We have a 4-bit binary number. If the line passes through the first quadrant, the 0th position is 1 (otherwise, 0). If the line passes through the second quadrant, the 1st position is 1 (otherwise, 0), and so on. For example, if the line passes through the first, second, and third quadrants, the binary number will be 0111, and the function output will be 7.
Check out your Company Bowl for anonymous work chats.