Question
5. Give the change to line 7 of the Unsorted Array structures Fetch algorithm shown below that would unencapsulate the structure after Fetch operation is
5. Give the change to line 7 of the Unsorted Array structures Fetch algorithm shown below that would unencapsulate the structure after Fetch operation is completed.
//access the node(assumes the node is in the structure)
i= O;
while(targetKey ! = data[i].key())
{i++;
}
//return a copy of the node to the client
return data [i].deepCopy();
7. The Sorted Array structure accesses nodes using the Binary Search algorithm, and the Unsorted-Optimized Array structure uses a Sequential Search to access nodes. Knowing that a binary search is significantly faster than a sequential search, explain why it is that the average speed of the Unsorted-Optimized array structure is faster than that of the Sorted Array structure. (Assume all four basic operations are equally probable.)
12. Plot the variation in density with the number of nodes, n, in an array-based structure. Assume each node contains 10 information bytes and the range is 2 n 100. Note: This question expects you to do a graph. You can do this by using Microsoft Excel with n in one column and the density in another column. Calculate the density using the formula D = 1 / (1 + 4 / w + 4 / (w * n)), where w =10. Points for n should include (2, 10, 20, 30, 40, , 90, 100). Use the X Y Scatter chart to create your graph. You then can copy and paste your resulting graph into this Word document.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started