Question-11. Give some examples greedy algorithms.

Answer- The below given problems find their solution using greedy algorithm approach −

            •	Travelling Salesman Problem
            •	Prim's Minimal Spanning Tree Algorithm
            •	Kruskal's Minimal Spanning Tree Algorithm
            •	Dijkstra's Minimal Spanning Tree Algorithm
            •	Graph - Map Coloring
            •	Graph - Vertex Cover
            •	Knapsack Problem
            •	Job Scheduling Problem

 

Question-12. What are some examples of divide and conquer algorithms?

Answer- The below given problems find their solution using divide and conquer algorithm approach −

 
          •	Merge Sort
          •	Quick Sort
          •	Binary Search
          •	Strassen's Matrix Multiplication
          •	Closest pair (points)

 

Question-13. What are some examples of dynamic programming algorithms?

Answer- The below given problems find their solution using divide and conquer algorithm approach−

 
        •	Fibonacci number series
        •	Knapsack problem
        •	Tower of Hanoi
        •	All pair shortest path by Floyd-Warshall
        •	Shortest path by Dijkstra
        •	Project scheduling

 

Question-14. What is a linked-list?

Answer- A linked-list is a list of data-items connected with links i.e. pointers or references. Most modern high-level programming language does not provide the feature of directly accessing memory location, therefore, linked-list are not supported in them or available in form of inbuilt functions.

Question-15. What is stack?

Answer- In data-structure, stack is an Abstract Data Type (ADT) used to store and retrieve values in Last In First Out method.

Question-16. Why do we use stacks?

Answer- Stacks follows LIFO method and addition and retrieval of a data item takes only Ο(n) time. Stacks are used where we need to access data in the reverse order or their arrival. Stacks are used commonly in recursive function calls, expression parsing, depth first traversal of graphs etc.

Question-17. What operations can be performed on stacks?

Answer- The below operations can be performed on a stack −

 
      •	push() − adds an item to stack
      •	pop() − removes the top stack item
      •	peek() − gives value of top item without removing it
      •	isempty() − checks if stack is empty
      •	isfull() − checks if stack is full

 

Question-18. What is a queue in data-structure?

Answer- Queue is an abstract data structure, somewhat similar to stack. In contrast to stack, queue is opened at both end. One end is always used to insert data (enqueue) and the other is used to remove data (dequeue). Queue follows First-In-First-Out methodology, i.e., the data item stored first will be accessed first.

Question-19. Why do we use queues?

Answer- As queues follows FIFO method, they are used when we need to work on data-items in exact sequence of their arrival. Every operating system maintains queues of various processes. Priority queues and breadth first traversal of graphs are some examples of queues.

Question-20. What operations can be performed on Queues?

Answer- The below operations can be performed on a stack−

    
    •	enqueue() − adds an item to rear of the queue
    •	dequeue() − removes the item from front of the queue
    •	peek() − gives value of front item without removing it
    •	isempty() − checks if stack is empty
    •	isfull() − checks if stack is full