Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8953711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:09:34+00:00 2026-06-15T14:09:34+00:00

In an interview I was asked to write an insert function for linked list

  • 0

In an interview I was asked to write an insert function for linked list in such a way that after the insertion, the element towards the head side of the inserted element should be greater and the tail side should be smaller when compared to inserted element.

I had implemented the following steps in my code:

  1. initially sort the linked list in descending order.
  2. get the element.
  3. insert the element in such way that the linked list will be in descending order even after insertion.

But I was told that my way was not efficient.

Please let me know if there are efficient way to achieve the same.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:09:35+00:00Added an answer on June 15, 2026 at 2:09 pm

    Sort is an O(n log n) operation. If you read the question carefully they never say the list should be sorted, so don’t do the sort operation. What you should do instead is start with a new list with only your element, then for each element of the original list append it either to the front (if greater than the new element) or otherwise at the back.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a job interview I was asked to write a function in C that
I faced an interview. where I was asked the following question Write a function
In an interview this is the question that is asked: You have to write
This is an interview Question that i was asked recently: Write a C program
Recently in an interview i was asked a question to write a function which
I have been asked in an interview to write a SQL query which fetches
I was once asked of this in an interview: How to write a recursive
A friend of mine was asked, during a job interview, to write a program
Yesterday in my interview I was asked this question. (At that time I was
Today in my interview , i was asked to write a code to determine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.