Practice 30 C Programming Questions on Heap
Q1. Define a structure for a basic heap and initialize an empty heap.
Q2. Write a function to insert an element into a min-heap.
Q3. Write a function to insert an element into a max-heap.
Q4. Write a function to return the minimum element in a min-heap.
Q5. Write a function to extract (remove) the minimum element from a min-heap and reorganize the heap.
Q6. Write a function to convert a given array into a min-heap.
Q7. Write a function to convert a given array into a max-heap.
Q8. Write a function to delete a specific element from a min-heap.
Q9. Write a function to perform heap sort on an array using a min-heap.
Q10. Write a function to perform heap sort on an array using a max-heap.
Q11. Write a function to check if a given array represents a min-heap.
Q12. Write a function to check if a given array represents a max-heap.
Q13. Write a function to convert an array to a max-heap using a heapify function.
Q14. Write a function to increase the value of a key in a min-heap at a given index and adjust the heap.
Q15. Write a function to decrease the value of a key in a max-heap at a given index and adjust the heap.
Q16. Write a function to find the kth largest element in an array using a min-heap.
Q17. Write a program to implement a heap using dynamic memory allocation.
Q18. Implement a priority queue using a max-heap.
Q19. Implement heap sort algorithm.
Q20. Write a function to check if a given array represents a max-heap.
Q21. Write a program to implement a min heap and display the elements.
Q22. Write a function to merge two max heaps into a single max heap.
Q23. Write a function to find the kth smallest element in an array using a max heap.
Q24. Implement Dijkstra's algorithm using a min heap.
Q25. Write a function to build a max heap from an unordered array.
Q26. Write a function to delete the root element from a max heap.
Q27. Write a function to increase the key of an element in a max heap.
Q28. Implement heap sort using a min heap.
Q29. Write a function to get the maximum element from a max heap.
Q30. Write a function to calculate the size of a max heap.
Bikki Singh
Hi, I am the instructor of TechnoVlogs. I have a strong love for programming and enjoy teaching through practical examples. I made this site to help people improve their coding skills by solving real-world problems. With years of experience, my goal is to make learning programming easy and fun for everyone. Let's learn and grow together!