问题描述
说
list<int> l={1,2,3,4,5};
typedef list<int> lst ;
lst l={1,5};
lst::iterator i=l.begin();
advance(i,2);//let the time complexity be n
l.erase(i);//what is the time complexity here?
for(auto i:l)
cout<<i<<endl;
既然链表是双向链表实现的,那么在o(1)时间内能不能找到它的上一个和下一个指针同时连接并去掉中间的那个?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)