Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CUSTOMER_CODE SMUDE DIVISION_CODE SMUDE EVENT_CODE OCTOBER15 ASSESSMENT_CODE BCA2020_OCTOBER15 QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 11324 QUESTION_TEXT What are the advantages and disadvantages of linear representation of binary tree? SCHEME OF EVALUATION Advantages: 1. Node can be accessed directly (2 marks) 2. Data are stored without printer(2 marks) 3. This is very useful where the language(2 marks) Dis advantages: 1. Memory is wasted here(2 marks) 2. Since the array size is limited (2 marks) QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 72861 QUESTION_TEXT What is post order traversal? Explain the algorithm for the same SCHEME OF EVALUATION In postorder traversal start with the left most subtree (4 mark) step 1: Start from the root node (1 mark) Step 2: Go to the leftmost node(1 mark) Step 3: When it is reached print it down (1 mark) Step 4: Visit the left most node’s parent node(1 mark) Step 5: Visit the first node of the right subtree (1 mark) Step 6: Proceed in the same way till printing of all the nodes is finished (1 mark) QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 72864 QUESTION_TEXT Explain the 2 types of binary tree a. Skewed binary tree b. Full binary tree SCHEME OF EVALUATION a. Skewed binary tree: A binary tree which has only left subtree is called left skewed tree and has only right subtree is called right skewed tree. Skewed trees are not efficient in memory management because generally, an n node binary tree needs an array whose length is between n+1 and 2n, but while storing skewed binary tree it wastes most of the memory space. b. Full binary tree: A binary tree is a full binary tree if and only if :- Each non leaf node has exactly two child nodes All leaf nodes are at the same level A full binary tree is a binary of depth k having 2k − 1 nodes as referred in the figure 4.5. If it has < 2k − 1, it is not a full binary tree. For example, for k = 3, the number of nodes = 2k − 1 = 23 − 1 = 8 − 1 = 7. A full binary tree with depth k = 3 is shown in Figure 4.5. We use numbers from 1 to 2k − 1 as labels of the nodes of the tree. If a binary tree is full, then we can number its nodes sequentially from 1 to 2k−1, starting from the root node, and at every level numbering the nodes from left to right. QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 72867 QUESTION_TEXT Explain the algorithm to inserting at the beginning of a list. Inserting at the beginning of list 1. [OVERFLOW?] if AVAIL = NULL, then: Write: OVERFLOW, and Exit. 2. [Remove first node from AVAIL list] Set N := AVAIL and AVAIL := LINK [AVAIL]. 3. Set DATA [N] := ITEM. [Copies new data into new node] 4. Set LINK [N] := START.[New node points to the original first node] 5. Set START := N. [changes START so it points to the new node] SCHEME OF EVALUATION 6. Exit. QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 125411 QUESTION_TEXT SCHEME OF EVALUATION Explain bubble sort and merge sort Bubble sort Bubble sort is a straightforward and simplistic method of sorting data that is used very commonly. The algorithm starts at the beginning of the data set. It compares the first two elements, and if the first is greater than the second, then it swaps them. It continues doing this for each pair of adjacent elements to the end of the data set. It then starts again with the first two elements, repeating until no swaps have occurred on the last pass. This algorithm is highly inefficient, and is rarely used except as a simplistic example. For example, if we have 100 elements then the total number of comparisons will be 10000. Bubble sort may, however, be efficiently used on a list that is already sorted, except for a very small number of elements. For example, if only one element is not in order, bubble sort will only take 2n time. If two elements are not in order, bubble sort will only take at most 3n time. Bubble sort average case and worst case are both O(n²). Merge sort Divide-and conquer is a general algorithm design paradigm: Divide: divide the input data S in two disjoint subsets S1and S2 Recur: solve the sub problems associated with S1 and S2 Conquer: combine the solutions for S1 and S2 into a solution for S The base case for the recursion is sub problems of size 0 or 1 Merge-sort on an input sequence S with n elements consists of three steps: Divide: partition S into two sequences S1 and S2 of about n/2 elements each Recur: recursively sort S1 and S2 Conquer: merge S1 and S2 into a unique sorted sequence. (5 Marks for each) QUESTION_TYPE DESCRIPTIVE_QUESTION QUESTION_ID 125413 QUESTION_TEXT Explain memory allocation and garbage collection. SCHEME OF EVALUATION Memory allocation (5 marks) Garbage collection (5 marks)