vishalmx3

vishal.codes

Posted on May 11, 2024

Day 41/366

šŸš€ Today's Learning:

šŸŒŸ DSA

  • Check if an array represents a min-heap or not
  • Convert min Heap to max Heap

šŸŒŸ Dev

  • pymongo library

šŸ” Some Key Highlights:

DSA

To check if an array represents a min-heap, iterate through each parent node starting from the last non-leaf node towards the root. At each step, compare the parent node with its children. If any child is smaller than the parent, it violates the min-heap property, indicating that the array doesn't represent a min-heap. If no violation is found, the array is a min-heap.

To convert a min heap to a max heap, begin by swapping the positions of the parent node and its largest child if any child is greater than the parent. Then, recursively perform this swap operation for each subtree until the entire heap satisfies the max-heap property. This process effectively transforms the min heap into a max heap.

DEV

The PyMongo library is a Python driver for MongoDB, enabling interaction with MongoDB databases from Python applications. It provides a simple and intuitive interface for performing various operations such as inserting, updating, querying, and deleting documents in MongoDB collections. With PyMongo, you can establish connections to MongoDB servers, access databases and collections, and execute commands and queries efficiently. Its design aligns with Python's philosophy, making it easy for developers to work with MongoDB databases seamlessly within their Python projects.

#100daysofcode #1percentplusplus #coding #dsa

šŸ’– šŸ’Ŗ šŸ™… šŸš©
vishalmx3
vishal.codes

Posted on May 11, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Day 42/366
1percentplusplus Day 42/366

May 12, 2024

Day 41/366
1percentplusplus Day 41/366

May 11, 2024

Day 40/366
1percentplusplus Day 40/366

May 10, 2024

Day 39/366
1percentplusplus Day 39/366

May 9, 2024

Day 38/366
1percentplusplus Day 38/366

May 8, 2024