Data Structures and Algorithms (ECE-4024)
Data Structures and Algorithms (ECE-4024)
1A. Create a class called COMPLEX which contains private data members to store real and imaginary
values of type float and public member functions for input and output operations. Create an
overloaded friend function of the form ADD(a, S2), ADD(S1, S2), where S1, S2 are complex
objects and ‘a’ is a real part. Write an interactive C++ program to add two complex number and
display the result.
1B. Write an algorithm and C++ program to insert an element at jth position in the array data structure.
1C. Two main measures for the efficiency of an algorithm are …………. and ……………
(5+4+1)
2A. Convert manually the following infix expression to postfix. Show the content of stack at each steps.
i). A + B * C – D / E * F ii). (A + B * C – D ) / ( E * F)
2B. What is the disadvantage of linear queue? How do you overcome this drawback? Write a formula
based C++ program to implement such a solution.
2C. ………… is very useful in situation when data have to stored and then retrieved in reverse order.
(5+4+1)
3A. Create a class called DLIST(Doubly Linked List) with private data members and member functions
to insert a node at a specified position, delete a node from a specified position of the list and display
the list. Class contains a private data member NODE of type struct which has a data and link fields.
Functions to insert and delete a node should take only position as an argument. Write an interactive
C++ program to demonstrate the operations by displaying the content of the list after every
operation.
3B. Create a class called SLIST which contain private data members NODE of type struct to hold data
and link field and necessary member functions to append, display and reverse the list. Write an
interactive C++ program to reverse a singly linked list without using another list.
3C. Linked list is generally considered as an example of ……………… type of memory allocation.
(5+4+1)