Skip to content

Only Code

Eat Code Sleep – repeat

  • Home
  • Arrays
  • Linked Lists
  • Trees
  • Stacks
  • Queues
  • Heaps
  • Graphs
  • Algorithms
    • Sorting
    • Dynamic Programming
    • Divide and Conquer
    • Backtracking & Recursion
    • Greedy approach
    • Breadth First Search (BFS)
    • Depth First Search (DFS)

Only Code

Eat Code Sleep – repeat

Close menu
  • Home
  • Arrays
  • Linked Lists
  • Trees
  • Stacks
  • Queues
  • Heaps
  • Graphs
  • Algorithms
    • Sorting
    • Dynamic Programming
    • Divide and Conquer
    • Backtracking & Recursion
    • Greedy approach
    • Breadth First Search (BFS)
    • Depth First Search (DFS)

Only Code

Eat Code Sleep – repeat

Search Toggle menu

Category: Heaps

Restaurant Rating Solution (Heap) | CodeChef [Medium]

Chef has opened up a new restaurant. He picks out the positive reviews and posts it on the website of the restaurant. A review is considered to be positive if it is among the top one-third of the total reviews when they are sorted by their rating.

Competitive Programming, Heaps, Interview Questions

C++ Standard Template Library (STL) – [Heap]

The Heap data structure is an array that can be viewed as a complete Binary Tree. Each node in the tree corresponds to an element of the array A[].
In this post we will learn about, how to build min/max Heaps using STL.

C/C++, Heaps, Special Data Structures

Heap Data structure | Heap Sort in C++

The Heapsort algorithm uses Heap data structure to sort an array in O(nlogn) time complexity. It starts by calling Build-Max-Heap.

Competitive Programming, Heaps, Sorting, Special Data Structures

C++ Standard Template Library (STL) – [Priority queue]

In the last post we discussed about C++ Standard Template Library (STL) Linked List. In this post we will learn about STL Priority queue and using it as Max/Min Heap. A priority queue is a data structure for maintaining a set of elements having an associated value.

C/C++, Heaps, Special Data Structures

Huffman Code Explained using Heap [Introduction to Algorithms book]

Huffman codes are a widely used technique for compressing data. Huffman codes is a greedy algorithm to build up an optimal way of representing each character as a binary string. Suppose we have a 10,000 character data file that we wish to store. And we observe a character ‘a’ occurs very frequently.

Greedy approach, Heaps

How to find k nearest neighbours of a given point from a set of points in a plane?

Let’s given n points in a plane. We’ve to find k nearest neighbours of a given point ‘p’ from the given n points.

Heaps, Mathematics
  • Algorithms
  • Arrays
  • Backtracking & Recursion
  • Breadth First Search (BFS)
  • C/C++
  • Competitive Programming
  • Databases
  • Depth First Search (DFS)
  • Divide and Conquer
  • Dynamic Programming
  • Graphs
  • Greedy approach
  • Hashmaps
  • Heaps
  • Interview Questions
  • Java
  • Linked Lists
  • Machine Learning
  • Mathematics
  • Networking
  • Python
  • Queues
  • Sorting
  • Special Data Structures
  • Stacks
  • Trees
  • Web Development
© 2023 Only Code.