answersLogoWhite

0

How would you sort a linked list?

Updated: 12/21/2022
User Avatar

Wiki User

13y ago

Best Answer
  1. Use merge sort
  2. Use tree sort
User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How would you sort a linked list?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What advantages of a sorted list over a linked list?

All lists are linked lists; there is no such thing as a separate "sorted list". There are algorithms that can sort a list, of course, but they all work on linked lists.


How do you improve insertion sort algorithm?

If there was a way, it would be the new insertion sort! Theoretically you could reduce the time by using a linked list and searching to the position it needs to be inserted and inserting it. In practice however you would be better off simply using a different sort, especially if you don't want your data in a linked list. Selection sort is better when writing is expensive. Quicksort and Mergesort are faster on large data sets.


Explain the linked list and multi linked list structures?

I tried my best to explain all Linked List. For Single Linked List http://www.fansonnote.com/2012/02/single-linked-list/ For Double Linked List http://www.fansonnote.com/2012/02/double-linked-list/ For Multi Linked List http://www.fansonnote.com/2012/02/multi-linked-list/ Hope it will help. Thanks.


What is a linked list used for?

A linked list is used in computer science to store data as a series of related nodes. Linked lists are used as the basis for abstract data types when programming. The chief advantage of a linked list is that data can be added or removed from the list without having to reorganize the whole list. A drawback to linked lists can be that it is difficult to sort, organize, or recall specific information from the list.


Convert single linked list to double linked list?

You copy a singly linked list into a doubly linked list by iterating over the singly linked list and, for each element, calling the doubly linked list insert function.


Which of the following cannot be implemented efficiently in linear linked list 1 quicksort 2 radix sort 3 polynomials 4 insertion sort 5 binary search?

radix sort


What is the difference between doubly linked list and circular linked list?

A doubly linked list allows traversal in both directions (forward and backward) by having each node point to both its next and previous nodes. A circular linked list is a type of linked list where the last node points back to the first node, forming a circular structure. This allows continuous traversal through the elements without a definitive end.


Which is the easy insertion operator single linked-list or double-linked list?

It is easier to insert into a singly linked list.


What is a singly linked linear list?

A singly linked list is a linked list which only provides links in "one direction". Using a metaphor, a singly linked list is a one way street, while a doubly linked list is a two way street. Once you move forward in a singly linked list, there is no way to go backwards unless you kept your reference/pointer from before. A singly linked list would look like this: start ----> node1---->node2---->node3 ----> NULL You will see that node2 only has a link forward to node3 - it does not have a link backwards to node1, even though node1 has a link forwards to node2. To prevent us from permanently losing access to portions of the linked list, we generally keep a reference/pointer to "start". A doubly linked list would have twice the number of pointers/references as a singly linked list - making it very inefficient to store small datatypes. On the other hand, it would be possible to move both forwards and backwards with a doubly linked list because you have links pointing both forwards and backwards.


What is the difference between linked list and Ordinary list?

A list is an abstract data structure, usually defined as an ordered collection of data. A linked list refers to a specific implementation of a list in which each element in the list is connected (linked) to the next element.


What is non-integer linked list?

Linked list of strings, for example.


Which data structure is Best for library management system wheater Tree or Linked list?

It depends on what you intend to do with the data. The assumption is the data is dynamic, the number of elements are not known in advance. Binary trees are best if you want to sort the data as it is entered. Linked lists are best if you simply want a list of sequential data, or need to implement a stack or a queue.