July 17, 2021 in C and CPP
Modify bubble sort algorithm in more efficient form so that it stops when no interchanges are needed.
b) Modify bubble sort algorithm in more efficient form so that it stops when no interchanges are needed.
July 17, 2021 in C and CPP
b) Modify bubble sort algorithm in more efficient form so that it stops when no interchanges are needed.
July 17, 2021 in C and CPP
a) Use the bubble sort to put the numbers 3, 2, 4, 1, 5 into increasing order. Illustrate the output returned in each pass clearly. Also write the pseudo algorithm to it.
July 17, 2021 in C and CPP
b) Show the results of inserting the keys F, S, Q, K, C, H, T, V, W, M, R, N, P, A, B, X, Y, D, Z, E in order into an empty B tree.
July 17, 2021 in C and CPP
a) Write an algorithm to delete an element x from a binary search tree t. Discuss your method with an example.
July 17, 2021 in C and CPP
b) Let P be of type of linked list. Write a ‘C’ function split to create two linked lists Q & R. Q contains all elements in odd positions of P and R contains the remaining elements. Your function should not change list P. What is the complexity of your program?
July 17, 2021 in C and CPP
a) Let A and B be two n x n lower triangular matrices. The total number of elements in the
lower triangles of the two matrices is n(n+1). Write a ‘C’ program to represent both triangles in an array d[n+1][n].
July 17, 2021 in C and CPP
b) Describe the implementation methods insertBefore(p,e), InsertFirst(e) and InsertLast(e)
of the list ADT, assuming the list is implemented using a doubly linked list.
July 17, 2021 in C and CPP
a) Let A and B be two structures of type Linked List. Write a ‘C’ function to create a new
Linked List C that contains elements alternately from A and B beginning with the first
element of A. If you run out of elements in one of the lists, then append the remaining
elements of the other list to C.
July 17, 2021 in C and CPP
A. Floor of log n! B. Ceiling of log n! C. m+n-1
D. m+n E. 2^n F. 2^n-1
G. 2000 H. 1000/2 I. Static
J. Dynamic K. p+q L. p+q-2
M. Logical properties N. Physical properties O. Segment violation
P. Block overflow Q. AB/CDE+AC R. AB/CDEAC*+
S. Strings T. Pointers U. inorder
4.1 A sorting algorithm on n elements based on binary comparisons requires at least
_______ comparisons.
4.2 Two sorted lists with m elements and n elements can be merged into a sorted list using
no more than _________ comparisons.
4.3 argv an array of pointers to _________.
4.4 The minimum size of an array to store a binary tree of n levels is ________.
4.5 The number of edges in a full binary tree with 1,000 internal vertices is ____________.
4.6 An error caused by a program trying to access memory outside its address space is
known as ________.
4.7 The storage class of a variable declared inside a function which allows retention of its previous value is termed as _________.
4.8 An abstract data type is a(n) __________.
4.9 Number of nodes required to store the adjacency list of a directed graph that has “p”
vertices and ‘q’ edges is __________.
4.10 The postfix form of the expression A/B ** C + D*E- A*C is _____________.
July 17, 2021 in C and CPP
Each statement below is either TRUE or FALSE. Choose the most appropriate one
and ENTER in the “tear-off” sheet attached to the question paper, following
instructions therein.
2.1 The Structures cannot contain a pointer to itself.
2.2 A simple graph is connected if and only if it has a spanning tree.
2.3 Insertion of an element in an array requires shifting of some elements of the array by
one position.
2.4 Two sorted lists with m elements and n elements can be merged into a sorted list using
no more than m+n-1 comparisons.
2.5 The number of disk accesses required for most operations on a B tree is inversely
proportional to the height of the tree.
2.6 The time required to perform a sequence of data structure operations is averaged over
all the operations performed in an Amortized analysis.
2.7 All the terminal nodes are traversed in the same order from left to right in in-order,
preorder and post-order traversals of a binary tree.
2.8 A complete binary tree with n internal nodes has (n-1) leaves.
2.9 AVL trees, 2-3 trees and B trees permits searches, inserts, deletes in O(log n) time.
2.10 The in-degree of a vertex is the number of edges leaving it.