---
title: "Discussion on \"Crushing Tech Interviews with the Two Heaps Pattern\" | Hashnode"
description: "Discussion on \"Crushing Tech Interviews with the Two Heaps Pattern\". If we have a problem where we're interested in knowing the smallest in element in one part of a given set of elements and the biggest element in the other part, we can use the two heaps pattern.\nLets work through this problem together:\nImplement a cl..."
url: "https://hashnode.com/posts/crushing-tech-interviews-with-the-two-heaps-pattern/60770ac34155da32fc83ab77"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Crushing Tech Interviews with the Two Heaps Pattern](https://techsloth.io/crushing-tech-interviews-with-the-two-heaps-pattern?utm_source=hashnode&utm_medium=feed)

If we have a problem where we're interested in knowing the smallest in element in one part of a given set of elements and the biggest element in the other part, we can use the two heaps pattern. Lets work through this problem together: Implement a cl...

Apr 14, 2021 · 4 min read · techsloth.io  
Read the article

-   [#interview](https://hashnode.com/tag/interview)
-   [#programming](https://hashnode.com/tag/programming)
-   [#software-development](https://hashnode.com/tag/software-development)
-   [#python](https://hashnode.com/tag/python)
-   [#technical-interview](https://hashnode.com/tag/technical-interview)

## Written by

[Sloth](https://hashnode.com/@TechSloth)

@TechSloth

  
[View profile](https://hashnode.com/@TechSloth)

Helping others perform better in technical interviews.

## Responses 1

Markdown supported · ⌘↵ to post

[Manish askani](https://hashnode.com/@manishaskani)

[Aug 1, 2021](https://hashnode.com/posts/crushing-tech-interviews-with-the-two-heaps-pattern/60770ac34155da32fc83ab77/comment/610702863b9b85399dcf5200)

Hey [Sloth](https://hashnode.com/@TechSloth) Nice article. A small correction. `We can insert into the max heap if the top element (i.e. the greatest element) is smaller than the element we're inserting` I think this is incorrect. We should insert into max heap if the inserting element is smaller than the top element of heap and not the other way round.
