Report

Report - EE113D Professor: Rajeev Jain TA: Rick Lan Project...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
EE113D Professor: Rajeev Jain TA: Rick Lan Project Report: Heap Sort Group Members: Shuofei Geng Michael Utanes Felix Lu
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Introduction: Our project revolved around the idea of sorting numbers. In our case the algorithm we specifically chose to implement is the “Heapsort” algorithm. The heap sort algorithm functions by creating a heap in which every node of the heap has two child nodes. At each step, a comparison is made between two levels and the larger number is moved towards the top of the heap. When all comparisons are made, the top of the heap is the max number. That number is extracted and the entire comparison process repeats until the heap is empty. At the end we have a sorted list of numbers in ascending order (Max-Heap). The heap sort algorithm does not require recursion but rather is an in-place algorithm. For large data sets the heap sort algorithm is ideal because it does not require massive recursion and can function with just a single array. As a result, the worst case running time for heap sort is O(n* log 2 (n)). The equipment necessary for this project included a PC and a DSKPlus board (DSP). The software that we used to generate a model of the heap sort algorithm was in C++. We used this source code to translate the code from “C” to assembly language as to be read into the DSP board. We did not have a previous project to work from; as a result we coded our project on our own. Project Development: The first step of the project was to decide what to implement. The motivation for picking a sorting algorithm is because how widely used sorting is in all kinds of applications. We felt that an efficient sorting algorithm, especially when implemented on the assembly level (when time efficiency is even more important) would be a great project to do. Also, a fast sorting algorithm has never been proposed and attempted by previous classes, so we thought it is unique as well. After deciding on the project, the next step was to model our project with a high level language (either Matlab or C) and try to convert the code using assembly language. There are a lot of resources on the internet on the topics of heap sorting, thus finding an efficient C model for our project was rather easy. We decided to use a model that would sort an array of numbers (the array size is correctly at 100 and with integer as inputs,
Background image of page 2
however, these parameters can be easily modified to fit all types and sizes of data) in ascending order. This required us to build a Max-Heap, and extract the maximum item on the heap every time and reconstruct the remaining items to abide by the heap order again. The C code for this step is rather straightforward, basically given an array of numbers, there will be a loop that handles constructing a max-heap. The definition of a Max-Heap is a binary tree which follows the heap order that the children is always less than the parent, and the root of the tree is always the maximum element of the array. The binary tree will be represented in an array, with the root at the first element and its two children
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 14

Report - EE113D Professor: Rajeev Jain TA: Rick Lan Project...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online