Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
merge 2 arrays
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; public void MergeSortedList(Node first, Node second) { //we would be adding node from second list to first list //If second node data id more than first one then exchange it if(first.data.ToString().compareto(second.data.ToString()) > 0) { node t = first; first = second; second = first; } head = first;//Assign head to first Node while ((first.next != null ) && (second != null)) { if (Convert.ToInt32(first.next.data.ToString())) < Convert.ToInt32(first.data.ToString())) { first = first.next;//iterate over the first node } else { Node n = first.next; Node t = second.next; first.next = second; second.next = n; first = first.next; second = t; } } if (first.next = null) { first.next = second; } }
run
|
edit
|
history
|
help
0
true or false
Linked Lists
Variables
Exemple Regex
Strings Mix
الحاسوب
Math Main
C# - Creating XLS filename from datetime
conditional Debug
https://www.compliantmechanisms.byu.edu/profile/new-free-robux-generator-2022/profile