Is the time complexity for both operations equal to O(log n)?
Remeber: the list is ordered, always ordered, and not double linked.
Is the time complexity for both operations equal to O(log n)? Remeber: the list
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Both insertion and deletion in an ordered linked list is
O(n)– since you first need to find what you want to delete/add [in deletion find the relevant node, and in insert – find the correct location of it] – which isO(n)– even if the list is ordered, because you need to get to this place while iterating from the head.An efficient special type of list that allows fast insertion, deletion and look up is called a skip list, and it uses more nodes to iterate quickly between non adjacent nodes