Part A 1. What is a data structure? Data structure is a mechanism for storing data and organizing it in some way. The data structures you use in Alice are list and arrays. 2. Which automatically grows in size as you add items to it, lists or arrays? The list automatically expands as items are added to it. 3. When you drag a list tile and drop it on top of a placeholder in an instruction, a menu will appear. What will be on the menu? A menu appears showing a list of the methods that you can call to modify the list.
How do you create an instruction that steps through an array, performing an operation on each item? You need to create a Loop instruction that executes once for each item in the array. 5. How do you randomly select an item in a list? How do you randomly select an item in an array? To randomly select an item in a list you drop the random item from list tile on top of the placeholder that is of the same type as the items in the list.
6. What is an ArrayVisualization object? ArrayVisualization is a class that is useful for visualization how an array works. 7.
If you are writing a program that will add items to data structure while the program is running, would you choose a list or an array as the data structure? You would use a list as the data structure if the program would add items to it while it’s running because lists and dynamic where arrays are fixed. 8. If you are writing a program that needs to access items in a data structure and execute as fast as possible, would you choose a list or an array as the data structure? You would use arrays as the data structure if you wanted to access the items as fast as possible because arrays are fixed.
Cite this Data Structure
Data Structure. (2018, Mar 06). Retrieved from https://graduateway.com/data-structure/