Question: Chapter 2 Array - Based Structures 3 . Give the mapping function used to calculate the address of the k th element of a one

Chapter 2 Array-Based Structures
3. Give the mapping function used to calculate the address of the k th element of a one-dimensional array of integers, assuming element zero is stored at location 500, the array is stored in ascending memory locations, and that an integer occupies 4 bytes of memory. 146
4.20 integers are stored in a two-dimensional array of four rows and five columns. The name of the array is ages.
a) Draw a picture of the rows and columns of the array, indicating the column numbers across the top of the array and the row numbers along the left side.
b) Place an x in the cell of your picture whose contents is modified by the statement: ages[2][3]=20;
c) Give the memory location of the cell ages[2][3] assuming the array is stored in row major order in ascending memory locations beginning at location 500. Assume each cell is 4 bytes.
6. A data structure is to be chosen that will allow the customers to look up the price of an item, given its item number. The data set will only be loaded once and never modified. Of the three array-based structures discussed in this chapter, which would be best suited for this application?
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.)
10. The Unsorted-Optimized array structure is used to store a data set. Calculate its density if:
a) Each of the client's nodes contains 8 bytes of information and there are 50 nodes in the data set.
b) Each of the client's nodes contains 200 bytes of information and there are 1,000,000 nodes in the data set
15. You have coded an application for your friend's business that uses an Unsorted-Optimized array to store the venture's data. One day your friend informs you that the speed of the operations performed on the data set seems to be getting faster and faster. Explain how this could happen

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!