Final answer:
To remove duplicates from a list without using a dictionary, you can iterate through the list and add elements to a new list if they are not already present in it.
Step-by-step explanation:
To write a function removeDuplicates() that removes duplicate elements from a given list without using a dictionary, we can use a simple algorithm:
- Create an empty list to store the unique elements.
- Iterate through each element in the given list.
- If the element is not already in the unique elements list, append it.
- Return the unique elements list.
Here is an example implementation in Python:
def removeDuplicates(lst):
unique_lst = []
for element in lst:
if element not in unique_lst:
unique_lst.append(element)
return unique_lst
# Example usage
given_lst = [1, 2, 2, 3, 4, 3, 5]
new_lst = removeDuplicates(given_lst)
print(new_lst) # Output: [1, 2, 3, 4, 5]