CS2208 1 SET2

download CS2208 1 SET2

of 5

Transcript of CS2208 1 SET2

  • 7/27/2019 CS2208 1 SET2

    1/5

    ANNA UNIVERSITY : CHENNAI 600 025

    B.E/B.Tech Degree Examinations, Oct-Nov-2012

    CS2208 Data Structures Lab

    Computer Science and Engineering

    Time: 3 Hours Maximum Marks: 100

    1Write a function program to perform the following operations on a singly linkedlist

    i. Create a listii. Insert an element to the listiii. Delete the maximum element from the listiv. Arrange the list as sorted orderv. Display the elements of the list

    Write a main method to demonstrate the above functionalities.

    (100)

    2Write a function program to perform the following operations on a singly linkedlist

    i. Create a listii. Find the smallest element from the listiii. Insert an element if it is not a duplicate elementiv. Display the elements in reverse orderv. Find the number of odd values and even values

    Write a main method to demonstrate the above functionalities.

    (100)

    3 Write a function program to perform the following operations on a doubly linkedlist

    i. Create a listii. Insert an element to the listiii. Delete a specific element from the listiv. Display the content of the listv. Find the number of elements in the list

    Write a main method to demonstrate the above functionalities.

    (100)

    4Write a function program to perform the following operations on a singly linkedlist

    i. Create a listii. Insert an element in a specific locationiii. Delete the last element of the listiv. Display the content of the listv. Find the maximum and minimum element of the list

    Write a main method to demonstrate the above functionalities.

    (100)

  • 7/27/2019 CS2208 1 SET2

    2/5

    5Create a structure called Node to store a term of a polynomial which contains thecoefficient, exponent part, and a link field to point to another node in the linkedlist. Write a function program to get two polynomials as input and also write afunction to perform addition operation on two polynomials. Also write a mainmethod to demonstrate the polynomial addition using singly linked list.

    (100)

    6Create a structure called Node to store a term of a polynomial which contains thecoefficient, exponent part, and a link field to point to another node in the linkedlist. Write a function program to get two polynomials as input and write anotherfunction to perform addition operation on two polynomials. Also write a mainmethod to demonstrate the polynomial subtraction using singly linked list.

    (100)

    7Let X and Y are two singly linked lists which stores a character of a string. Writea function to perform the following operations

    i. Create a listii. Finds the number of characters in each stringiii. Find the first character in the string X which does not occur in

    string Y

    iv.

    Concatenate the two stringv. Display the two stringWrite a main method to demonstrate the above functions.

    (100)

    8Write a function to read an expression and which is stored inX=A+B*C+(D*E+F)*G as infix format. Write an algorithm to transform an infixexpression X into its postfix equivalent and also write a function to evaluate thepostfix expression. Write a main method to demonstrate the above functions.Assume that the infix expression X is terminated by a character #.

    (100)

    9Write a function to read an expression and which is stored inX=(A+B)*D+E/(F+A*D)+C as infix format. Write an algorithm to transform aninfix expression X into its postfix equivalent and also write a function to evaluate

    the postfix expression. Write a main method to demonstrate the above functions.Assume that the infix expression X is terminated by a character $.

    (100)

    10Write a function to read an expression X=A+B*C+(D*E+F)*G. Write anotherfunction to form an expression tree for the expression X and evaluate the same.Also include a main program to demonstrate the expression tree and evaluate it

    (100)

    11Write a function to read an expression X =(A+B)*D+E/(F+A*D)+C. Writeanother function to form an expression tree for the expression X and evaluate thesame. Also include a main program to demonstrate the expression tree andevaluate it.

    (100)

    12Write a function program to perform the following operations in double-endedqueue

    i. Create a double ended queueii. Insert an element into the queueiii. Delete an element from the queueiv. Display all the elements of the queuev. Find the maximum element from the queue

    Write a main method to execute the above functions

    (100)

  • 7/27/2019 CS2208 1 SET2

    3/5

    13Write a function program to perform the following operations in double-endedqueue

    i. Create a double ended queueii. Display all the elements of the queueiii. Find the minimum element from the queueiv. Insert an element which is not existing in the queuev. Sort the elements in ascending order

    Write a main method to equip the above functions

    (100)

    14Write a function program to perform the following operations in binary searchtree

    i. Create a binary search treeii. Display the content of the treeiii. Insert an element into the treeiv. Delete an element from the treev.

    Find the leftmost element from the treeWrite a main method to demonstrate the above functions

    (100)

    15Write a function program to perform the following operations in binary searchtree

    i. Create a binary search treeii. Display the content of the treeiii. Find the largest element from the treeiv. Count the number of even value data from the tree (ie value

    divided by 2)v. Count the total number of elements in the tree.

    Write a main method to demonstrate the above functions

    (100)

    16Write a function program to perform the following AVL tree operations

    i. Create a binary search tree with the value of 1, 3, 5, 7, 9ii. Perform the rotation operation for converting the BST to AVL treeiii. Insert an element to the treeiv. Delete an element from the treev. Display the content of the AVL tree

    Write a main method to demonstrate the above functions

    (100)

    17Write a function program to perform the following AVL tree operations

    i. Create a binary search tree with the value of 10, 8, 6, 4, 2ii. Perform the rotation operation for converting the BST to AVL treeiii. Find the smallest element from the tree AVL treeiv. Count the number of elements using traverse operation in the AVL

    treev. Display the content of the AVL tree

    Write a main method to demonstrate the above functions

    (100)

  • 7/27/2019 CS2208 1 SET2

    4/5

    18Write a function program to perform the following AVL tree operations

    i. Create a binary search tree with the value of 1, 2, 3, 4, 5ii. Perform the rotation operation for converting the BST to AVL treeiii. Find the largest element from the AVL treeiv. Find the sum of all elements in tree using traverse operation in the

    AVL treev. Display the content of the AVL tree

    Write a main method to demonstrate the above functions

    (100)

    19Write a function program to perform the following priority queue operations

    i. Create a array of 10 different elementsii. Convert the array elements into binary heapiii. Insert an element into the heapiv. Delete the minimum element from the heapv. Display the content of the heap

    Write a main method to demonstrate the heap operations

    (100)

    20Write a function program to perform the following priority queue operations

    i. Create a array of 10 different elementsii. Convert the array elements into binary heapiii. Find the largest element from the heapiv. Find the number of elements from the heap using traverse

    operationv. Display the content of the heap

    Write a main method to demonstrate the heap operations

    (100)

    21 Implement Prims algorithm with the following functionalities

    i. Read a set of vertices minimum of six from the keyboardii. Get the number of edges and form the graphiii. Find the value of each edge by using distance formula for two

    points.iv. Develop a Minimum Spanning Tree for the graphv. Find the total length of all edges.

    Write a main method to execute the above functionalities

    22Implement Prims algorithm with the following functionalities

    i. Read a set of vertices minimum of six from the keyboardii. Get the number of edges and form the graphiii. Find the value of each edge by using distance formula for two

    points.iv. Develop a Minimum Spanning Tree for the graphv. Find the maximum and minimum length of the edges

    Write a main method to execute the above functionalities

  • 7/27/2019 CS2208 1 SET2

    5/5

    23Write a function program to perform the following operations whileimplementing hashing technique

    i. Create a hash table of size minimum of 10ii. Apply a hash function (mod) to find the keyiii. Insert an element in to the hash tableiv. Search an element from the hash tablev. Display the hash table and its key values

    Write a main method to execute the above function using open addressing

    24Write a function program to perform the following operations whileimplementing hashing technique

    i. Create a hash table of size minimum of 10ii. Apply a hash function (mod) to find the keyiii. Insert an element in to the hash tableiv. delete an element from the hash tablev.

    Display the hash table and its key valuesWrite a main method to execute the above function using open addressing