Tag: Heap
Posts of Tag: Heap
  1. Heap Sort in JavaScript

    Introduction In this guide, we will explore Heap Sort - the theory behind it and how to implement Heap Sort in JavaScript. We will start off with what data structure it's based on (massive foreshadow here: it's...Learn More
  2. Heap Sort in Java

    Introduction Sorting is one of the fundamental techniques used in solving problems, especially in those related to writing and implementing efficient algorithms. Usually, sorting is paired with searching - me...Learn More
  3. Heap Sort in Python

    Heap Sort in Python Introduction Heap Sort is another example of an efficient sorting algorithm. Its main advantage is that it has a great worst-case runtime of O(n*logn) regardless of the input data. As the na...Learn More
  4. Stack vs Heap – Difference between Stack and Heap in Data Structure

    **Stack vs Heap – Difference between Stack and Heap in Data Structure** In this tutorial you will learn about stack vs heap data structures. Stack Stack is a simple data structure used for storing data. In stac...Learn More
    StructureData StructureStackHeap
  5. Implementing a 4-heap using an array

    What kind of math do you use to traverse the 4-heap when using an array to store all the elements? Specifically, how do you find the index of a parent node to a specific leaf? Let's say I have the following ar...Learn More
  6. How to make heapq evaluate the heap off of a specific attribute?

    I wish to hold a heap of objects, not just numbers. They will have an integer attribute in them that the heap can sort by. The easiest way to use heaps in python is heapq, but how do I tell it to sort by a sp...Learn More
  7. Python performance: heaps

    I'm trying to write an optimal function that given a list of items, returns a reordered list with the top_k items at the start (they don't need to be ordered themselves). I don't have any constraint on the orde...Learn More
  8. Heap Configuration in Elasticsearch

    Nothing Less Nothing More It should not consider that if the size of heap is large, every reference of objects are allocated memory. If the size of heap is larger than it should be, when heap is full and the g...Learn More
  9. Is there any limit on stack memory?

    I was going through one of the threads. A program crashed because it had declared an array of 10^6 locally inside a function. Reason being given was memory allocation failure on stack leads to crash. when sam...Learn More
  10. min heap in python

    I'd like to store a set of objects in a min heap by defining a custom comparison function. I see there is a heapq module available as part of the python distribution. Is there a way to use a custom comparator...Learn More
  11. JVM fails to allocate XMS under Suse SLES10 X64 running on VMWare ESX

    I am trying to allocate ram with xms = xmx on a sles10 x64 running under VMware. When stopping the JVM the following error is thrown: Java HotSpot(TM) 64-Bit Server VM warning: Failed to reserve shared memory (...Learn More
  12. Stack, Static, and Heap in C++

    I've searched, but I've not understood very well these three concepts. When do I have to use dynamic allocation (in the heap) and what's its real advantage? What are the problems of static and stack? Could I wr...Learn More