1 Why Data Structures Matter ACT
1 Why Data Structures Matter ACT
1. Write down your answers below. List down all the steps necessary to:
a. Insertion at the beginning of the array
1. We declare an array
2. Make 2 parameters, one for which array to modify, and the other one is what
element to insert
3. Using insert() to determine where to insert the element
4. Test if the function works
1. Declare an array
2. Make 3 parameters, one for which array to modify (arr), where to place the
element (index) and the other one is what element to insert (element)
3. Test if it works
2. Paste a screenshot of the code below. Write a Python function that enables you to add a
new element to a list from scratch . The function should take two parameters: arrayIndex
and givenList. Please keep in mind that the function should not have Python’s pre-built
methods like pop(), append(), and remove().
3. Paste a screenshot of the code below. Write a Python function from scratch that enables
you to delete an element from a list. The function should take two parameters:
arrayIndex and givenList. Please keep in mind that the function should not have
Python’s pre-built methods like pop(), append(), and remove().
4. Paste a screenshot of the code below. Write a Python function that returns only the
unique values from a given list and then write a code demonstrating the use of Python’s
set() method. What are the differences between these two codes you’ve written? Write
your answer below the code.
Manual:
Set: