Filter by Tags

Time complexity and Space complexity - Linked List

Votes

0

0 0

What is the time and space complexity of the following operations in linked list



  1. Insert element at the end of the list

  2. Remove element at the end of the list

  3. Insert element in the middle of the list

  4. Read the value of the second last element of the list.

  5. Update the value of the middle element of the list.

Open E-School
Posted on : Wed, Jun 14, 2017
Views : 165
Comments

Ask Question

If you want to ask question you must LogIn or SignUp
Login SignUp

Answers (2)


0

Time and Space Complexity of insertion at end is : O(n) and O(1).

Time and Space Complexity of deletion at end is : O(n) and

Time and Space Complexity of insertion at middle is : O(n) and O(1)

Time and Space Complexity to read last second element is : O(n) and

Time and Space Complexity to update value at middle is : O(n) and

 

Above Complexities are according to Singly LinkList.

Sahil Gaba
Wed, Jun 14, 2017
Loading...
Comments

Edit Answer

Submit

0
  1. Time Complexity - O(n)
    Space Complexity - O(1)
  2. Time Complexity - O(n)
    Space Complexity - O(1)
  3. Time Complexity - O(n/2)
    Space Complexity - O(1)
  4. Time Complexity - O(n-1)
    Space Complexity - O(1)
  5. Time Complexity - O(n/2)
    Space Complexity - O(1)
Apurva Thakker
Wed, Jun 14, 2017
Loading...
Comments

Edit Answer

Submit
This answer will permanently deleted. Do you really want to delete this Answer ?
To Add your Answer Please
LogIn | SignUp

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp