private void button2_Click(object sender, EventArgs e) { KarthicLinkedList linkedlist = NodeHelper.GetLinkedListByString(this.textBox6.Text); int value = Convert.ToInt16(this.textBox7.Text); this.textBox5.Text = NodeHelper.GetStringByNode(partitionlinkedlist(linkedlist.headnode, value)); }
private void button4_Click(object sender, EventArgs e) { KarthicLinkedList list1 = NodeHelper.GetLinkedListByString(this.textBox6.Text); KarthicLinkedList list2 = NodeHelper.GetLinkedListByString(this.textBox4.Text); Node result = FindIntersectionofTwoList(list1, list2); this.textBox5.Text = result.Data.ToString(); }
private void button13_Click(object sender, EventArgs e) { string input = this.textBox1.Text; KarthicLinkedList list = NodeHelper.GetLinkedListByString(input); this.textBox2.Text = NodeHelper.GetStringByNode(RemoveDuplicatesWithoutExtraBuffer(list.headnode)); }
private void button12_Click(object sender, EventArgs e) { string input = this.textBox1.Text; KarthicLinkedList list = NodeHelper.GetLinkedListByString(input); this.textBox2.Text = NodeHelper.GetStringByNode(AvoidDuplicateswithhead(list.headnode)); }
private void button3_Click(object sender, EventArgs e) { KarthicLinkedList linkedlist1 = NodeHelper.GetLinkedListByString(this.textBox1.Text); KarthicLinkedList linkedlist2 = NodeHelper.GetLinkedListByString(this.textBox3.Text); linkedlist1.headnode = KarthicLinkedListHelper.MergeSort(linkedlist1.headnode); linkedlist2.headnode = KarthicLinkedListHelper.MergeSort(linkedlist2.headnode); Node result = FindCommonElements(linkedlist1.headnode, linkedlist2.headnode); this.textBox2.Text = NodeHelper.GetStringByNode(result); //linkedlist1.headnode = KarthicLinkedListHelper. }
private void button5_Click(object sender, EventArgs e) { string input = this.textBox1.Text; KarthicLinkedList node = NodeHelper.GetLinkedListByString(input); KarthicBinaryTree <int> bt = new KarthicBinaryTree <int>(); bt.Root = new KarthicBTNode <int>(node.headnode.Data); //set 1st level bt.Root.Left = new KarthicBTNode <int>(node.headnode.Next.Data); bt.Root.Right = new KarthicBTNode <int>(node.headnode.Next.Next.Data); //set 2nd level bt.Root.Left.Left = new KarthicBTNode <int>(node.headnode.Next.Next.Next.Data); bt.Root.Left.Right = new KarthicBTNode <int>(node.headnode.Next.Next.Next.Next.Data); bt.Root.Right.Left = new KarthicBTNode <int>(node.headnode.Next.Next.Next.Next.Next.Data); bt.Root.Right.Right = new KarthicBTNode <int>(node.headnode.Next.Next.Next.Next.Next.Next.Data); }
private void button3_Click(object sender, EventArgs e) { KarthicLinkedList linkedlist = NodeHelper.GetLinkedListByString(this.textBox1.Text); //Make it circular Node node = new Node(); //this is just a hack to make list cirucular...there might be good way to do this //it won't work for no loop foreach (Node n in linkedlist) { if (n.Data == linkedlist.lastnode.Data) { node = n; break; } } linkedlist.lastnode.Next = node; Node startloop = GetLoopStartNode(linkedlist.headnode); this.textBox2.Text = startloop.Data.ToString(); }
private void button1_Click(object sender, EventArgs e) { KarthicLinkedList linkedlist = NodeHelper.GetLinkedListByString(this.textBox4.Text); this.textBox3.Text = IsPalindrome(linkedlist.headnode) == true ? "Palindrome" : "Not a Palindrome"; }
private void button5_Click(object sender, EventArgs e) { KarthicLinkedList linkedlist = NodeHelper.GetLinkedListByString(this.textBox10.Text); this.textBox9.Text = NodeHelper.GetStringByNode(MergeSort(linkedlist.headnode)); }