I 098 11 give the average number of memory accesses

This preview shows page 6 - 8 out of 11 pages.

i. 0.98 11. Give the average number of memory accesses of the Unsorted-Optimized array structure whose data set is described in part(b) of the previous exercise: a. Assuming all operations on the data set are equally probable i. 0.75n +1.5 memory accesses b. Assuming only Insert operations will be performed on the data set i. 3
Image of page 6

Subscribe to view the full document.

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 that the range of n is 2 <= n <= 100 (in notebook) 13. Define the data structures term garbage collection a. Garbage collection: the process of returning memory assigned to a program, or to a data structure, that is no longer in use to an available memory pool. 14. Describe the garbage collection method for the Unsorted-Optimized array structure a. i = 0; while (targetKey != data[i].key) { i++ } data[i].data[next-1] next = next -1 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. 16. An application’s data set will consist of five different types of nodes. Is the data set homogeneous or heterogeneous? a. Heterogeneous 17. Give the six design features that should be followed when designing generic data structures a. 1. The node definition and the data structure are coded as two separate classes 2. The data structure cannot mention the names of the data fields that make up a node 3. If the structure is going to be encapsulated, a method to perform a deep copy of a node must be coded in the node definition class 4. If the structure is going to be accessed in the key field mode, a method to determine if a gicen key is equal to the key of a node must be coded in the node definition class 5. The data structure code cannot mention the name of the node class 6. The data structure code cannot mention the type of the key 18. Give the pseudocode of an update method for the Unsorted structure that does not invoke the delete and insert methods and does check for errors. Chapter 3
Image of page 7
1. Which of the two access modes cannot be used to access restricted structures? a. Key field access 2. Which of the four basic operations do restricted structures support (indicate if any are combined?) a. Fetch and Delete are combined, while Insert is stand-alone. Update is not supported 3. Name two restricted structures. a. Stacks and Queues 4. Tell what the following acronyms stand for and which restricted structures they are associated with. a. LIFO i. Last In First Out - Stack b. FIFO i. First In First Out – Queue 5. Give the names of the operations that can be performed on the following structures, and tell what the operations do a. A stack i. Initialization – top = -1, size = s Push –insert Pull – delete b. A queue i. Initialization – size = s, numberOfNodes = 0; first = 0, last = 0 Enqueue – insert Dequeue – delete 6. Nodes A, B, and C are placed on a stack in the order first A, then B, and finally C.
Image of page 8
You've reached the end of this preview.
  • Spring '16
  • Array data structure

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern