#Doubly linked list time complexity insertion worst case O(1)?

21 messages · Page 1 of 1 (latest)

potent stormBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

scenic solstice
#

2nd question: yes it is O(n)

#

1st question: i don't understand what you are asking

winter lance
#

I don't think that's possible with a linked list

candid summit
#

Are you required to not have duplicates in the list?

scenic solstice
#

Data in the linked list doesn't matter

candid summit
#

?

#

Handled for what?

#

You just insert as usual, if there are no other requirements. 🤷‍♂️

scenic solstice
#

What's the purpose?

winter lance
#

If you needed to prevent duplicates from being added you would typically use a different data structure that can handle that more efficiently

scenic solstice
#

Infinite grid? cartesian plane with values attached to points?

#

oh an Excel program

#

I think you are using the wrong data structure

#

Use a 2d array if possible

#

Initialize all values to 0 and transfer the problem onto the user of your program

candid summit
#

Microsoft Excel does have a limit in the number of rows and columns.

scenic solstice
#

2d dynamic array?

#

that's probably what you want

#

i've never actually used 2+d arrays now that I mention them

potent stormBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity