Mridul-1-Sharma / data_structures_algos

Contribute to this repository with valid pull request to Hacktoberfest 2022 and earn awesome swags & T-shirts. This is a beginner friendly Project.
MIT License
7 stars 27 forks source link

Delete it, I will do a pull request for them again. #52

Closed JunJul closed 2 years ago

JunJul commented 2 years ago

I will only upload the .cpp

JunJul commented 2 years ago

@Mridul07Sharma I already upload it as a .cpp file.

JunJul commented 2 years ago

I already uploaded it and added two more functions. The search function is to search an element in the list if it cannot find the element, so return -1. If it finds the element, then delete it. We need to move the elements in the array when deleting an element. This remove function still costs O(n). On the contrary, a linked list only need to link node together after removing a node. This is O(1).