answersLogoWhite

0


Best Answer

You can either insert one list directly into the other, or you can create a completely new list and insert the two lists one after the other. Neither method requires a temporary variable. Temporaries are only required when you need to swap one list for another, but you can minimise this requirement by using "move semantics", where the lists can simply swap their resources, not the elements themselves. In this way, only one temporary is required.

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you merge two linked list without using any temporary variable?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Which is preferred for writing a Merge Sort routine contiguous or linked memory?

Linked memory because its very useful primarily when the lists to be sorted are very large and the size of data to be moved is small.


Is merge sort external sorting?

Can be. (Meaning: you can merge sorted files without loading them entirely into the main memory.)


What is the code for c and c plus plus program to merge two circular linked list?

Circular linked lists are really no different to ordinary linked lists, other than that the tail node points back to the head node (and vice versa if the list is doubly-linked). Therefore the merge process is exactly the same: iterate through the second list and insert each node's data into the first list. Since lists are un-associated containers, it doesn't matter where the insertions occur but, by convention, insertions typically occur at the tail of the list. If an order must be maintain, an insertion sort should be employed instead. Note that if you need to maintain the original two lists (in their un-merged state), simply copy the first and insert the second into the copy instead.


What are the disadvantages of using mail merge?

Advantages: It is quick and easy. It saves time. You can address a large number of letters without having to do it yourself as mail merge inserts it for you. Disadvantages: It can be used as a scam. It runs slowly or doesn't run at all when more than one software is running. If it is email merge all recipients will be able to view all data and information.


Can you implement merge sort without using recursion?

Sure, recursion can always be substituted with using a stack.

Related questions

How would you sort a linked list?

Use merge sortUse tree sort


What is a process that inserts variable information into a document to produce a customized document?

Mail Merge.


If WikiTree is supposed to be a single lineage-linked database why does there appear to be a tool to merge entire trees but not a tool to link individuals in other trees?

WikiTree is intended to be a single, worldwide family tree. Ideally, there should be one lineage-linked profile for every individual who ever lived. The merge tool does not merge entire trees, it merges individuals. When duplicate profiles of the same individuals are merged, they aren't just linked. They are fully combined into one profile.


How to write aC program to merge two singly linked list?

write a c program to circular queue


Which is preferred for writing a Merge Sort routine contiguous or linked memory?

Linked memory because its very useful primarily when the lists to be sorted are very large and the size of data to be moved is small.


Is merge sort external sorting?

Can be. (Meaning: you can merge sorted files without loading them entirely into the main memory.)


Is it merge in or merge into?

Merge into is more correct.


What is the meaning of merge?

of Merge


How do you merge cells without losing data?

Combine the data within the cells to be merged before merging them.


What is the merge sign?

A merge sign is a sign that instructs road users to merge.


When two lanes merge into one and there is a collision who is at fault?

The lane that goes straight through without changing is the main lane. If you merge into that lane, you have to yield to the flow of traffic. That means if your lane ends, it is you that should yeild.


What is a list of variable informatin tha is merged with a main document to create customized form letters or labels?

It can be a data file or source data file. It is used in the mail merge process.