Difference between Binary Tree and Binary Search Tree
5 stars based on
We have studied a number of data structures and their algorithms for storing and retrieving data. The performance of the retrieval searching of the data has also been derived theoretically.
The summary of data structures and their searching performance is given below. The purpose of this final project is to implement several of these structures and measure the relative performance of searching out data in the structure.
Your results should correspond to the theoretical results, otherwise you must have a flaw in your implementation. The expected ranking of each of the six searches is also given.
Store this collection of integers in the various data structures then perform a series of retrievals of random values in the collection and measure emperically the time it takes to do the retrievals in each of the structures.
You should run this program with varying quantities of data usually double the size to see the variations in the structures' retrieval performances. The basic approach is to design the test driver to generate a large array of numbers in random order. The size of the array should be interactively entered. For this description, let's call the size N. Be sure they're positive. Your driver should print out the first 10 elements and the last 10 elements to verify that the array contains random values.
Once you have a random array of numbers test the searching algorithm for each data structure in turn. For each data structure, generate a random number r between 0 and N-1 and retrieve randArray[r] as the search key, search for the search key--you should always find it and we won't measure searches that fail, and measure the time it took. To get something measurable, you should repeat searches with different search keys, of course between the start and stop timer.
In other words, get the system time, perform searches, get the system time and report the difference. Move to the next structure and repeat the searches on that structure and report the search time. Do not, however measure the time to prepare the loading of the data structure as described below. Data Structure Preparation Compare and contrast linked list and binary search tree Array Just search the array as prepared Sorted Array Create a second array of size N, copy the array over,and use the quicksort to sort the second array.
Now use a binary search. The duplicate compare and contrast linked list and binary search tree shouldn't cause any problems. Use division modulus as your hash function. Again use division as your hash function You may use any code available from the text or from the Java standard library.
Be sure to clearly indicate what code is borrowed and from where, and what code is yours. Be sure that the borrowed code truely implements the data structure you really want to test. Be sure you properly use the Integer wrapper for Listable and Comparable datatypes.
As in any scientific experiment, run this simulation with different array sizes N to demonstrate that your performance measurements are a function of array size and is congruent to the expected performance of the searching algorithm.
For searching algorithms of the same complexity, also try to explain the why one may be better than another, i. Compare the results of the searching of these six structures in a table and write up a word conclusion bid on binary options trading demo account without deposits compare results to theory.
Write your conclusion and table of results using Word. Submit your report with the listings and runs. Create a second array of size N, copy the array over,and use the quicksort to sort the second array. Load the tree from the original array. Load the hash table with the original unsorted array using simple linear probing. Load this compare and contrast linked list and binary search tree table with N buckets; each bucket a compare and contrast linked list and binary search tree list.
Again use division as your hash function.