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.

18 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
941 views

Fibonacci heap in Python

I have this implementation of the Fibonacci heap in Python: ...
4
votes
0answers
36 views

Binary Heap implementation in Common Lisp and tests

I implemented a basic [binary heap] https://en.wikipedia.org/wiki/Binary_heap() in Common Lisp to learn programming using the CLOS. It is quite neat and self-contained, the core of the program is ...
4
votes
0answers
953 views

Linked list implementation of binary heap insertion

Is this a correct linked list implementation of binary heap insertion? This is not a homework exercise. ...
4
votes
0answers
128 views

Heap update generic algorithms

In the standard library, there are no algorithms for element updates. This makes it unsuitable as a queue for a Dijkstra's algorithm, for example. Thus I implemented generic heap update functions with ...
4
votes
0answers
642 views

Binomial Heap in Haskell

Here's a partial binomial heap implementation in Haskell (just merge and insert): ...
3
votes
0answers
202 views

Implementing binary-heap in x86-64 assembly

I'm trying to implement some of the simplest classical data-structures in x86-64 assembly on linux. PRIMARY GOAL: Reduce memory consumption and increase performance (maybe using x86-64 architecture ...
3
votes
0answers
121 views

Finding the maximal bottleneck in a 2D matrix from source to destination

I recently started solving programming challenges and this one is causing me performance trouble. The problem statement is the following: You are given a 2d matrix where each cell contains an ...
2
votes
0answers
438 views

Max Heap Data Structure Implemented with Python List

Created a max heap using a Python list as the base storage. The heap starts at index 1. Here is the heap: ...
2
votes
0answers
428 views

Min-Heap based priority queue class written in ES6

I would appreciate any feedback on syntax, naming convention, possible shortcuts, clarity of code and any other constructive feedback. This code was based off of the Priority Queue chapter in The ...
1
vote
0answers
81 views

Max-Heap Implementation in Kotlin

I am concerned about a few things about my heap implementation. This is in Kotlin. For starters- When and when not to use expressions? The use of also to swap ...
1
vote
0answers
105 views

Max heap in Haskell

I wrote a (max) heap in Haskell which is balanced after every (public) operation. Not based on any documentation. Focus is on: speed, that is the right time-complexities (not necessarily optimal); ...
1
vote
0answers
60 views

Comparing two heap sift algorithms in Java

My research question was to find out whether minimizing the number of assignments in a heap lead to any time savings. The "optimized" version stores the element to sift, sift the minimum to its place ...
1
vote
0answers
497 views

Minimum Priority Queue using Heap

After getting suggestions for Maximum Priority Queue I have written program for Minimum Priority Queue. Help me improve this code. ...
1
vote
0answers
462 views

Generic Pairing Heap Performance

I have made a generic pairing heap library in C. Pairing heaps are one of the several heap variants with better asymptotic running times than standard binary heaps (others include Fibonacci heaps and ...
1
vote
0answers
100 views

Generic implementation of mutable binary heap

std::priority_queue does not support dynamically updating element priorities. This class template extends it by allowing updating priorities of elements in the heap....
1
vote
0answers
2k views

Min Heap Sort using Generics

Here is my working code for a min-heap sort using an Array-List. I would like any input as to areas that need additional refining and any areas that are against proper formatting/usage. Although not ...
1
vote
0answers
362 views

Building a correct d-max heap bottom up

I want to implement a d-max heap using a bottom-up approach. This way I will start from the last parent in the tree and build myself up to the root of the heap. We will compare children and parents in ...
1
vote
0answers
708 views

Binary heap implementation in Golang

I have implemented a binary heap in Go to get familiar with the language. GitHub ...