Updated Linked List (incomplete)
This commit is contained in:
		@@ -1,7 +1,3 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using C_.Datastructures.Nodes;
 | 
			
		||||
 | 
			
		||||
namespace C_.Datastructures
 | 
			
		||||
@@ -27,7 +23,23 @@ namespace C_.Datastructures
 | 
			
		||||
 | 
			
		||||
        public static LinkedList<T> Create(LinkedList<T> list1, LinkedList<T> list2){
 | 
			
		||||
            //Append a previous list to a new List
 | 
			
		||||
            return null;
 | 
			
		||||
            LinkedList<T> list;
 | 
			
		||||
            
 | 
			
		||||
            list = list1;
 | 
			
		||||
            if (list == null || list.Count == 0)
 | 
			
		||||
            {
 | 
			
		||||
                //If list 2 is the only list present
 | 
			
		||||
                return list2;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //Find end of list and append fist item of next list
 | 
			
		||||
            if (list2 == null || list.Count == 0) return list;
 | 
			
		||||
 | 
			
		||||
            Node<T>? end = list.Traverse();
 | 
			
		||||
            end!.Next = list2!.Head;
 | 
			
		||||
            list.Count += list2!.Count;
 | 
			
		||||
 | 
			
		||||
            return list;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -60,7 +72,7 @@ namespace C_.Datastructures
 | 
			
		||||
        private Node<T>? Traverse(){
 | 
			
		||||
            //Start at Head of list
 | 
			
		||||
            Node<T>? node = Head;
 | 
			
		||||
            if (node == null)
 | 
			
		||||
            if (node != null)
 | 
			
		||||
            {   
 | 
			
		||||
                //continue to end of list
 | 
			
		||||
                while (node!.Next != default(Node<T>))
 | 
			
		||||
@@ -71,10 +83,10 @@ namespace C_.Datastructures
 | 
			
		||||
            return node;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private Node<T> Traverse(Node<T> start){
 | 
			
		||||
        private Node<T>? Traverse(Node<T> start){
 | 
			
		||||
            //Start at given point in list
 | 
			
		||||
            Node<T> node = start;
 | 
			
		||||
            if (node == null)
 | 
			
		||||
            Node<T>? node = start;
 | 
			
		||||
            if (node != null)
 | 
			
		||||
            {
 | 
			
		||||
                //Continue to end of list
 | 
			
		||||
                while (node!.Next != default(Node<T>))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user