Data%20Strs%20using%20C%20EC401

Embed Size (px)

Citation preview

  • 8/6/2019 Data%20Strs%20using%20C%20EC401

    1/2

    EC 401USN 11M ^ -S I 0

    M.S. RAMAIAH INSTITUTE OF TECHNOLOGY(AUTONOMOUS INSTITUTE, AFFILIATED TO VTU)

    BANGALORE - 560 054SUPPLEMENTARY SEMESTER EXAMINATIONS - 2010

    Course & Branch : B.E (Electronics & Communication Engg.) Semester IVSubject Data Structures Using C MxMarks 100Subject Code EC401Duaon. 3hsInstructions to the Candidates:

    Answer one full question from each unit.

    1. a)UNIT-I

    What do you understand by dynamic memory allocation? Explain any two (06)b) functions that support dynamic allocation.Explain call by value and call by reference functions. Give one example. (06)c) Write a 'C' program to find the largest element in a given matrix of size (08)

    2. a)m x n.Write a function using passing parameters to exchange the value stored in (06)

    b)2 locations in the memory.Write short notes on program testing and debugging. (06)

    c) Differentiate between mallocO, callocQ, freeO with examples. (08)

    3. a)UNIT-II

    What is linear search? Write a program to search for an item using linear (10)b)

    search.What is Hashing? Explain various methods for resolving hash collisions. (10)

    4 . a ) Explain depth first traversal and breadth first traversal of a tree. (10)b ) What is sorting? Explain insertion sort. (05)c ) What are networks? Compute the minimum spanning tree for the following (05)

    raph.

    5. a)UNIT-III

    What is doubly linked list? What are its advantages? (05)b) Write a function to concatenate two singly linked list into a single list (05)c) Write a program which includes insert front(), insert rear() and display() (10)

    for a singly linked list.Page1o 2

  • 8/6/2019 Data%20Strs%20using%20C%20EC401

    2/2

    EC4016. a) Write a function to insert and delete an element at the specified position in (10)

    a circular singly linked list.b) Write a function to delete an element from an ordered singly linked list. (10)

    7. a)UNIT-IV

    What is a stack? Write functions for all the basic operations to implementstacks in C.

    (10)

    b) Show the contents of the stack S after each of the operations. Assume the (05)1 pop(s),tack size to be 5. push(S,3), push(S,2), pop(S), push (S,3) " " " -

    pop(S ) , push ( S,6), push(S,8),push (S,12).

    c) Find the output of the following program-segment:x='a'y=,b,z=/c'push(S,x), push(S,'d'), pop(S),push (S,z),pop(S,z),push (S,'z')while, (!empty stack (S))printf("%c", pop(s))

    (05)

    8. a) Formulate an algorithm to covert an infix expression to postfix expression.Trace your algorithm on the following input. ((A+B-C)*D)

    (10)

    b) Convert the following infix expression to postfix:(i) A+B-C(ii) A-B/(C*D$E)(iii) (A+B)*(C-D)(iv) A+B*C-D/E*F

    (04)

    c) Explain a priority queue based on insertion sort technique algorithm.UNIT-V

    (06)

    9. a) What is a binary search tree? Write an algorithm for inserting an item inthe binary search tree.

    (10)

    b) Write a program to perform a tree traversal in inorder and postorder. (10)

    10. a) What is an expression tree? (04)b) Write prefix representation of tree of the infix expression (10)6+(3-2)*5)^2+3).c) Draw the tree for the preorder and inorder expression given and give the

    post order expressionPreorder : ABDGCEHIFInorder : DGBAHEICF

    (06)

    **************************

    push (S, 1), push(S,#), push(S,10),

    Page 2 of 2