I am not familiar with linked list, can any one help?

O(n)

A linked list is some nodes each of which has a link to the next node (singly linked) or both the next and previous nodes (doubly linked). Each list has a head node, doubly linked lists have a tail node too. Search for an element must proceed from one end until the element is found, so on average you will have to look through half the nodes to find a given element. Let C be 0.5 and O(C*n) is the same as O(n), as aspire1 said. ... but re-reading your post and seeing 'worst case' then let C be 1.0 and you get the same answer anyhow.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.