Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
merge 2 sorted array
//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; namespace Rextester { 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
xx
String concat operation (+) vs StringBuilder
SKYIES
1 -5 6 x1=3 x2=2
Array value changer?
Print("This is a Test")
t
custom Queue Implementation
Leapyear
Inheritance Fallback