Basic CS-Data Structures [3i Infotech Placement]: Sample Questions 46 - 47 of 52

Glide to success with Doorsteptutor material for competitive exams : get questions, notes, tests, video lectures and more- for all subjects of your exam.

Question 46

Data Structures
Edit

Describe in Detail

Essay▾

How does a stack differ from a queue?

Explanation

Difference between Stack and Queue
StackQueue
  • Object are inserted and removed at the same end.
  • Object are inserted and removed from different ends.
  • Only one pointer is used.
  • Two different pointers are used for front and rear ends.
  • Follow Last in First Out order.
  • Following First in First Out order.
  • Operations are called push and pop.
  • Operations are called enqueue and dequeue.
  • Visualized as vertical collections.
  • Visualized as horizontal collections.
  • Does not have variants.
  • Variants like circular queue, priority queue, doubly ended queue.
  • Implementation is simple
  • Implementation is complex
  • The element inserted first is removed last.
  • The element inserted first is removed first.

Question 47

Data Structures
Edit

Describe in Detail

Essay▾

What is spanning Tree?

Explanation

  • A spanning tree- subset of Graph G, with all the vertices covered with minimum possible number of edges.
  • So, spanning tree does not have cycles
  • It cannot be disconnected.
  • Every connected and undirected Graph G has at least one spanning tree.
  • A disconnected graph does not have any spanning tree; it cannot be span all its vertices.
The Spanning Tree
  • The complete undirected graph has maximum number of spanning trees.
  • The above for example has possible spanning trees.

Developed by: