Skip to main content

Questions tagged [heap]

A heap is a tree-based data structure that satisfies the heap property. For questions about memory allocated from the system heap, use the [memory-management] tag.

7 votes
4 answers
552 views

I developed a heap sort variant that sorts a heap through traversal. Unlike in the standard heap sort, the algorithm does not remove the min element from the heap instead it traverses all the nodes of ...
ariko stephen's user avatar
8 votes
2 answers
443 views

I tried to optimize heap sort algorithm. Instead of recursion, I used iteration: ...
iskander's user avatar
  • 121
4 votes
2 answers
321 views

Description I've written a heap allocator in C++ using an explicit free list for organization. I've also written a series of unit tests and a microbenchmark using Catch2. At time of writing I've ...
pdm's user avatar
  • 307
2 votes
2 answers
276 views

I am more on data analyst than a programmer, but I do enjoy coding for fun. I tried to implement a Heap in rust. I would appreciate any return you may have, so I can improve. ...
RomainL.'s user avatar
  • 314
15 votes
5 answers
4k views

I have tried to implement my Heap in C. The following are the 13 operations defined: build_maxheap insert exctract_max (delete heap max root) max_delete (delete an element or key) max_heapify clear ...
V_head's user avatar
  • 575
5 votes
1 answer
888 views

From scanf() to fgets(), we need to first specify the maximum length of the string input, due to which input gets a limitation, ...
Darth-CodeX's user avatar
5 votes
1 answer
108 views

This is my very first data structure written in Perl for a d-ary heap: ...
coderodde's user avatar
  • 32.3k
2 votes
3 answers
573 views

Introduction and context I am working on a small application which involves sorting 20GB files as one of the operations. This is being done, due to memory constraints, by breaking them into ~1GB ...
Oliver Schönrock's user avatar
5 votes
2 answers
744 views

I wrote a binary heap structure class in C++. It is a templated class with a comparison type as one of the template parameters to allow for a min or max heap. I have not written anything in C++ in a ...
mastmartelli's user avatar
1 vote
1 answer
94 views

Main Questions: Is my runtime analysis correct? Is my approach optimal or close to it? Is there a better way and/or improvements? Objective: Write an algorithm to assign ...
MPC's user avatar
  • 61
2 votes
1 answer
246 views

I am trying to determine the correctness of a helper method within my MaxHeap class. The goal of this helper method is, given the index of any node in the Max Heap, sink it to the correct level in the ...
MPC's user avatar
  • 61
2 votes
2 answers
108 views

I'm looking for any sort of optimization and/or conventional practice tips, such as using the appropriate data types and naming my variables appropriately. ...
mastmartelli's user avatar
8 votes
1 answer
502 views

I'm learning Rust by implementing basic data structures and algorithms. I implemented a binary heap (max heap): ...
ryanzidago's user avatar
3 votes
1 answer
370 views

I have implemented basic max heap insertion and deletion functions without recursion ...
minglyu's user avatar
  • 133
2 votes
1 answer
308 views

While working on the following leetcode problem: https://leetcode.com/problems/top-k-frequent-elements/ I used a Priority Queu implementation in Ruby. I have learned how to implement a Priority Queu ...
Steven Aguilar's user avatar

15 30 50 per page
1
2 3 4 5
11