Skip to content

[BUG] Wrong output given by sorting/heap_sort.cpp #867

@ayaankhan98

Description

@ayaankhan98

Program is giving wrong output

Description

try the program with input

Enter number of elements of array
10
Enter Element 0
-10
Enter Element 1
78
Enter Element 2
-1
Enter Element 3
-6
Enter Element 4
7
Enter Element 5
4
Enter Element 6
94
Enter Element 7
5
Enter Element 8
99
Enter Element 9
0

Expected Behavior

Expected the correct sorted array

Actual Behavior

getting this wrongly sorted array output

Sorted Output
-10
-6
78
7
4
-1
5
0
94
99

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions