My Computer Forum Computer Science Forum

Go Back   My Computer Forum > Computer Science Forum > Algorithms

Algorithms Algorithms and Data Structures - Analysis, Graph, Search, String, Sorting, Merge, Compression, Optimization, Quantum


Reply
 
LinkBack Thread Tools Display Modes
April 26th, 2008, 11:03 AM   #1
 
Joined: Apr 2008
Posts: 5
Heap Sort Help

Hi I was wondering if you guys could help me on the following Questions....
a) What is a heap? b ) Explain in words how the heap sort algorithm sorts an array
into an increasing sequence[4 marks]

I got the first part.

A heap is a tree based data structure, which is also ordered. if for example Node A is the parent Node B ,then key(A)>= key(B) , as the parent Node (A) is always larger then child Node (B)

For the second part I wrote this:
The heap sort has two stages. first the array is sorted and turned into a heap, then the heap is reordered so that the final array is in ascending order.

Would you say that a good enough answer for part b) of the question ?

any help would be great thanks
david cool is offline  
 

My Computer Forum is free to register and we welcome everyone!

April 26th, 2008, 01:32 PM   #2
 
Joined: Dec 2007
Posts: 232
Re: Heap Sort Help

I would say that after heapifying, the elements are drawn out in their ordered state. Maybe that's just wording?
CRGreathouse is offline  
April 27th, 2008, 03:35 AM   #3
 
Joined: Apr 2008
Posts: 5
Re: Heap Sort Help

nah i think that does sound better actually ... cheers :mrgreen:
david cool is offline  
Reply

  My Computer Forum > Computer Science Forum > Algorithms

Tags
heap, sort



Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Choose heap or bst Rebecka Algorithms 0 December 14th, 2012 04:30 PM
Merge Sort (Two types ?) david cool Algorithms 4 April 29th, 2008 11:18 PM





Copyright © 2018 My Computer Forum Forum. All rights reserved.