Exemple #1
0
        private void button6_Click(object sender, EventArgs e)
        {
            //we don't have access to the list or the head
            //give the node and we need to delete the node

            //Implemented my own node :)


            string input = this.textBox8.Text;

            //LinkedList<int> numberlist = new LinkedList<int>();
            KarthicLinkedList numberlist = new KarthicLinkedList();

            foreach (string s in input.Split(','))
            {
                Node node = new Node();
                node.Data = Convert.ToInt32(s);
                numberlist.AddNode(node);
            }


            StringBuilder sb = new StringBuilder();

            foreach (var item in numberlist)
            {
                sb.Append(item.Data.ToString()).Append(",");
            }



            this.textBox7.Text = sb.ToString();

            //  this.textBox7.Text = Deletenode(numberlist, Convert.ToInt32(this.textBox6.Text));
        }
        public static KarthicLinkedList GetLinkedListByString(string input)
        {
            KarthicLinkedList numberlist = new KarthicLinkedList();

            foreach (string s in input.Split(','))
            {
                numberlist.AddNode(new Node(Convert.ToInt32(s)));
            }

            return(numberlist);
        }
Exemple #3
0
        private void button14_Click(object sender, EventArgs e)
        {
            string input = this.textBox8.Text;

            //LinkedList<int> numberlist = new LinkedList<int>();
            KarthicLinkedList numberlist = new KarthicLinkedList();

            foreach (string s in input.Split(','))
            {
                numberlist.AddNode(new Node(Convert.ToInt32(s)));
            }

            this.textBox7.Text = Iteratefromhead(DeleteReduntactNode(numberlist.headnode, Convert.ToInt32(this.textBox6.Text)));
        }
Exemple #4
0
        private void button10_Click(object sender, EventArgs e)
        {
            string            input1 = this.textBox10.Text;
            string            input2 = this.textBox11.Text;
            KarthicLinkedList list1  = new KarthicLinkedList();

            foreach (string s in input1.Split(','))
            {
                list1.AddNode(new Node(Convert.ToInt32(s)));
            }
            KarthicLinkedList list2 = new KarthicLinkedList();

            foreach (string s in input2.Split(','))
            {
                list2.AddNode(new Node(Convert.ToInt32(s)));
            }

            Node result = AddTwoLinkedListFromBackwards(list1, list2);

            this.textBox9.Text = Iteratefromhead(result);
        }