496 views
0 votes
0 votes

2 Answers

1 votes
1 votes

1)EVEN THOUGH LINKED LIST IS IMPLEMENTED USING ARRAY,TO DELETE A ELEMENT FROM LIST IT TAKES WPRST CASE OF O(N).

because elements are not stored in either incresing order and decresing order,we are not guarantee deleted element occupies which position.so to search entitre list then only know which place it occupies.

2) To reverse the list with the help of last pointer go last node in unit of time and make it as head node.

it is implemented using cirular array ,so no need of change any pointers only first and last pointer .it is done in o(1) time

0 votes
0 votes
1 2 3 4 5 6 7 8 9 10

1) Delete Kth element in linked list implemented using array : 

pos=k;

for (i=pos-1; i<10; i++)
    {
        llist[i] = list[i+1];
    }

so for deletion it will take O(n) time in shifting elements .

2) Reverse Element of linked list:

To reverse linked list we have to just swap head and tail pointers , so it can be done in O(1) time.

Answer: B

Related questions

0 votes
0 votes
1 answer
1
Mrityudoot asked Feb 25
187 views
How can we find the highest element in a singly linked list in O(1)? We are free to use any extra space.
9 votes
9 votes
2 answers
4
GO Classes asked May 4, 2022
513 views
If $f(n) = O(g(n))$ and $f(n) = \Omega(g(n)),$ then it is always true that$f(n) = o(g(n)).$$f(n) = \theta(g(n)).$$f(n) = \omega(g(n)).$both A and B are always true.