Sunteți pe pagina 1din 5

C PROGRAMMING AND DATA STRUCTURES

Important Questions
_________________________________________________________________________

UNIT –VI Linear DataStructures : Introduction to DataStructures, representing stacks and queues in C using
arrays, Infix, Postfix and Prefix programs, circular queues
5. Write a routine reduce that accepts an infix string and forms an equivalent infix string
with all superfluous parentheses removed.

5. Write a recursive function that accepts a prefix expression consisting of binary


operators and single-digit integer operands and returns the value of expression

4.a) Write a program in C to convert a given infix expression into its postfix equivalent.
b) Distinguish between sequential and linked allocation for representing linear lists.

4. Write a C program that uses a stack to convert a given infix expression into its postfix
form.

5. Declare two stacks of varying length in a single array. Write C routines push1, push2,
pop1 and pop2 to manipulate the two stacks.
5. Declare two stacks of varying length in a single array. Write C routines push1, push2,
pop1 and pop2 to manipulate the two stacks.
5. Write a program to convert a given prefix expression to postfix expression using
stacks.

5. Write a program to convert a given postfix expression to prefix expression using


stacks.

7. Give the storage representation of following list using adjacency matrix and list
structure
a) (a,(b,(c,d)),e,f)
b) ((x),y,A,z) where A= (a,b,(c,d))

_________________________________________________________________________

Computer Programming and Data structures 1


C PROGRAMMING AND DATA STRUCTURES
Important Questions
_________________________________________________________________________

UNIT – VII
Linked Lists : Singly linked list, Doubly linked list, Circular List, representing stacks and Queues in C using
linked lists Non-Linear Data Structures : Binary trees: Representation, tree traversals, graph representation,
graph traversal, Spanning trees.

7. Explain the representation of graph using adjacency matrix. Give the necessary
algorithm.
6. Write a function in ‘C’ to form a list containing the union of the elements of two lists.

6. Write a function in ‘C’ to form a list containing the intersection of the elements of two
lists.

6. Write a function in ‘C’ to insert an element after the nth element of a list

7. Write and explain the breath first traversal and depth first traversal in a graph
with algorithm
6. How can a polynomial in three variables (x,y and z) be represented by a singly linked
list? Each node should represent a term and should contain the powers of x, y, and z
as well as coefficient of that term. Write a C program to add two such polynomials.

7. Write notes on spanning tree. Write and explain the algorithm for minimal cost.
3.a) Write C functions to perform the following operations:
(i) insert an integer into deque (ii) delete an integer from deque.
b) Write a recursive function in C to find the greatest common divisor of two given
positive integers.
5.a) Explain with a suitable example how a binary tree in threaded.
b) Explain with an example how the deletion operation is performed on a binary search
tree.
c) Write a C function to copy a binary tree.
8. Write notes on any TWO of the following:
a) Collison resolution techniques in Hashing
b) Spanning trees
c) Traversals of a binary tree.

6.a) Explain the different ways of representing the graphs in the memory.
b) Write an algorithm (or C program) for breadth first search of a given graph.

3.a) Distinguish between sequential and linked allocation for representing linear list.
b) Write a C function to reverse a linked list with first node pointed to by list. Do not
copy the list elements; rather, reset links and pointers so that list points to the last
node and all links between nodes are reversed.

6. Write a C Program to exchange two nodes of a singly linked list.

_________________________________________________________________________

Computer Programming and Data structures 2


C PROGRAMMING AND DATA STRUCTURES
Important Questions
_________________________________________________________________________

6. Represent a doubly linked list using an array. Write routines to inset and delete
elements for this representation.

6. Write a routine to concatenate two doubly linked lists.

6.a) Write recursive functions in C for preorder and post order traversals of a binary tree.
b) Explain with an example how an element is deleted from a binary search tree.

6. Write a routine to concatenate two singly linked lists.

5. Write a program to evaluate a postfix expression using stack.

6. Write a function in ‘C’ to combine two ordered lists in to a single ordered list.

6. Write a function in ‘C’ to remove duplicate elements in a singly linked list.

7. Write an algorithm for determining whether two binary trees A and B are similar
based on the traversal method.

7. Formulate non-recursive and recursive algorithm for converse in order


traversal of binary tree.
7. Formulate non-recursive and recursive algorithm for Postorder traversal of binary
tree.

7.a) Explain the different ways of representing graphs in memory.


b) Write an algorithm for depth first search of a given graph.

7. Formulate non-recursive and recursive algorithm for converse in order traversal of


binary tree.

7. Explain the preorder sequential representation and postorder


sequential representation of a binary tree with example.

6. Write a C Program to exchange two nodes of a singly linked list.


6. Write a function in ‘C’ for a singly linked list, which reverses the direction of links.

_________________________________________________________________________

Computer Programming and Data structures 3


C PROGRAMMING AND DATA STRUCTURES
Important Questions
_________________________________________________________________________

7. Formulate non-recursive and recursive algorithm for converse in order traversal of


binary tree.

7. Formulate non-recursive and recursive algorithm for preorder traversal of binary


tree.

7. Formulate non-recursive and recursive algorithm for preorder traversal


of binary tree.

5.a) Write a recursive function in C to find the greatest common divisor of two integers.
b) Write C functions for insertion and deletion operations for a queue implemented as a
linked list.

5. Declare deque of integers where left and right indicate two ends. Write routines
remvleft, remvright, insrtleft, insrtright to remove and insert elements at left and right
ends of deque.

5. Define input-restricted deque as deque in which insertion is restricted to one end and
deletion can be made at either end. Write routines to implement operations on this deque.

5. Define output-restricted deque as deque in which deletion is restricted to one end and
insertion can be made at either end. Write routines to implement operations on this
deque.

5. Write a routine REVERSEQ that will reverse all elements in a queue .

6. Represent a circular linked list using an array. Write routines to insert and delete
elements for this representation.

7. Formulate non-recursive and recursive algorithm for Postorder traversal of binary


tree.

_________________________________________________________________________

Computer Programming and Data structures 4


C PROGRAMMING AND DATA STRUCTURES
Important Questions
_________________________________________________________________________

UNIT – VIII Sorting & Searching : Searching Methods- Linear and binary search methods, Sorting methods-
Ex: Bubble sort, Selection sort, Insertion sort, heap sort, quick sort.

8. Explain heap sort with example. Write necessary algorithms.

8.a) By hand, trace the action of heap sort on the following lists. Draw the initial tree to
which the list corresponds. Show how it is converted into heap and show how the
resulting heap as each entry is removed from the top and the new entry inserted.
12 20 34 27 30 36 23
b) Discuss the advantages and disadvantage of all sorting techniques with example.

8. Trace through the steps by hand to sort the following list in Quick sort
28 7 39 3 63 13 61 17 50 21

8.a) Write a C function to create Heap for the given list of integers.
b) Write a recursive function in C to search for an integer element in an array of sorted
integers using binary search.
8. Design an algorithm that will delete the entry with the largest key from the top of the
heap and restore the heap properties of the resulting smaller list.

7.a) Write insertion sort algorithm for sorting a given array of integers in ascending order.
b) Write a recursive function in C to search for an integer in a given sorted array of
integers using binary search.
8.a) Explain the algorithm for exchange sort with a suitable example.
b) Compare sort and exchange sort.

8. Explain the algorithm for selection sort and give a suitable example.

8.a) Write and explain linear search procedure with a suitable example.
b) Formulate recursive algorithm for binary search with its timing analysis.

8.a) Write and explain non-recursive algorithm for binary search with suitable
example and discuss the various time complexities of binary search.
b) Suppose that the list contains the integers 1,2,…8 in this order. Trace through the
steps of binary search to determine what comparisons of keys are done in searching.
(i) to locate 3 (ii) to locate 4.5

_________________________________________________________________________

Computer Programming and Data structures 5

S-ar putea să vă placă și