小杨采用如下双链表结构保存他喜欢的歌曲列表:
struct dl_node { string song; dl_node* next; dl_node* prev; };小杨想在头指针为head的双链表中查找他喜欢的某首歌曲,采用如下查询函数,该操作的时间复杂度为( )。
dl_node* search(dl_node* head, string my_song) { dl_node* temp = head; while (temp != nullptr) { if (temp->song == my_song) return temp; temp = temp->next; } return nullptr; }