Class BinaryHeapFormatter


  • public class BinaryHeapFormatter
    extends java.lang.Object
    • Constructor Detail

      • BinaryHeapFormatter

        public BinaryHeapFormatter()
    • Method Detail

      • toStringTree

        public static <E extends java.lang.Comparable<E>> java.lang.String toStringTree​(BinaryHeap<E> heap,
                                                                                        int maxDepth)
        Creates a multi-lines string representing a tree view of the given binary heap.
        Parameters:
        heap - The binary heap to display.
        maxDepth - Maximum depth of the tree to display.
        Returns:
        a string containing a tree view of the given binary heap.
      • toStringSorted

        public static <E extends java.lang.Comparable<E>> java.lang.String toStringSorted​(BinaryHeap<E> heap,
                                                                                          int max_elements)
        Creates a multi-lines string representing a sorted view of the given binary heap.
        Parameters:
        heap - The binary heap to display.
        maxElement - Maximum number of elements to display. or -1 to display all the elements.
        Returns:
        a string containing a sorted view the given binary heap.
      • main

        public static void main​(java.lang.String[] args)