1)Explain how to implement two stacks in one array A[1,...,n] in such a way that neither stack overflows unless the total number of elements in both stacks together is n. The run time of PUSH and POP is O(1).
2)Explain how to implement a queue using two stacks. Analyse the running time of the queue operations.
3)Explain how to implement a stack using two queues. Analyse the running time of the stack operations.
4)Write four O(1)-time procedures to insert elements into and delete elements from both ends of a deque constructed from an array.
5)Implement a stack using a singly linked list L. The run time of PUSH and POP should be O(1).
6)Implement a queue using a singly linked list L. The run time of ENQUEUE and DEQUE should be O(1).
7)Can the dynamic-set operation INSERT be implemented on a singly linked list in O(1) time? What about DELETE?
8)Implement the dictionary operations INSERT,DELETE and SEARCH using singly linked,circular lists.What are the running times of the procedures?
9)Give a THETA(n)-time nonrecursive procedure that reverses a singly linked list of n elements. The procedure should use no more than constant storage beyond that needed for the list itself.
10)Write the operations of INSERT, DELETE and SEARCH in a linked list.Also, how do we reverse a linked list?
can ny1 give me ans for 4...
ReplyDeleteHere, are some sample questions based on “Data Structures”. Read it carefully as these questions will improve your basic concept on Data Structures using C programming language, and will help you in cracking any interview.
ReplyDeleteClick on any question to find out it's answers:
Question - 1) What Is Data Structure ?
Question - 2) What Is The Need For Data Structures In Programming ?
Question - 3) What Are The Different Data Types Which A Data Structure May Comprise Of ?
Question - 4) How Can Data Structures Be Classified ?
Question - 5) What Are Linear Data Structures ?
Question - 6) What Are Non Linear Data Structures ?
Question - 7) Differentiate Between Data Types & Data Structures ?
Question - 8) List Four Major Operations On Linear Data Structures ?
Question - 9) What Do You Mean By A Static Data Structure ?
Question - 10) What Is Dynamic Memory Allocation ?
Question - 11) What Is A Stack ?
Question - 12) What Is A Queue ?
Question - 13) What Are Linked Lists ?
Question - 14) What Are Trees ?
Question - 15) What Are Arrays ?