How would you sort a linked list?

Answer Posted / sdfg

write an insert in order function where it traverse the list until it finds a greater element and put it before it.
create a new list and insert all items in the old list to the new list using the InsertInOrder function

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is peek in stack?

447


Does hashset maintain order?

482


What is unhashable type list?

476


Which interfaces are implemented by enumset?

493


Which type of memory allocation is referred for linked list?

760






What are the main differences between the linked list and linear array?

524


What is the difference between hashset and linkedhashset?

503


Tell me why can't constant values be used to define an array's initial size

528


What is a spanning tree in data structure?

518


Define a complete binary tree?

530


What is the height of a binary tree?

495


Why is treeset sorted?

516


Can a tree be empty?

482


Design a datastructure to represent the movement of a knight on a chess board

549


How many pointers are necessary to implement a simple linked list?

674