mirror of
				https://github.com/krahets/hello-algo.git
				synced 2025-11-04 22:28:40 +08:00 
			
		
		
		
	Merge branch 'master' of https://github.com/haptear/hello-algo
# Conflicts: # codes/csharp/chapter_array_and_linkedlist/list.cs # codes/csharp/chapter_array_and_linkedlist/my_list.cs # codes/csharp/include/PrintUtil.cs # codes/csharp/include/TreeNode.cs
This commit is contained in:
		@ -45,7 +45,7 @@ namespace hello_algo.chapter_array_and_linkedlist
 | 
				
			|||||||
            Console.WriteLine("在索引 3 处插入数字 6 ,得到 list = " + string.Join(",", list));
 | 
					            Console.WriteLine("在索引 3 处插入数字 6 ,得到 list = " + string.Join(",", list));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* 删除元素 */
 | 
					            /* 删除元素 */
 | 
				
			||||||
            list.Remove(3);
 | 
					            list.RemoveAt(3);
 | 
				
			||||||
            Console.WriteLine("删除索引 3 处的元素,得到 list = " + string.Join(",", list));
 | 
					            Console.WriteLine("删除索引 3 处的元素,得到 list = " + string.Join(",", list));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* 通过索引遍历列表 */
 | 
					            /* 通过索引遍历列表 */
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ namespace hello_algo.include
 | 
				
			|||||||
    public class ListNode
 | 
					    public class ListNode
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        public int val;
 | 
					        public int val;
 | 
				
			||||||
        public ListNode next;
 | 
					        public ListNode? next;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
        /// Generate a linked list with an array
 | 
					        /// Generate a linked list with an array
 | 
				
			||||||
@ -26,7 +26,7 @@ namespace hello_algo.include
 | 
				
			|||||||
        /// </summary>
 | 
					        /// </summary>
 | 
				
			||||||
        /// <param name="arr"></param>
 | 
					        /// <param name="arr"></param>
 | 
				
			||||||
        /// <returns></returns>
 | 
					        /// <returns></returns>
 | 
				
			||||||
        public static ListNode ArrToLinkedList(int[] arr)
 | 
					        public static ListNode? ArrToLinkedList(int[] arr)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            ListNode dum = new ListNode(0);
 | 
					            ListNode dum = new ListNode(0);
 | 
				
			||||||
            ListNode head = dum;
 | 
					            ListNode head = dum;
 | 
				
			||||||
@ -44,7 +44,7 @@ namespace hello_algo.include
 | 
				
			|||||||
        /// <param name="head"></param>
 | 
					        /// <param name="head"></param>
 | 
				
			||||||
        /// <param name="val"></param>
 | 
					        /// <param name="val"></param>
 | 
				
			||||||
        /// <returns></returns>
 | 
					        /// <returns></returns>
 | 
				
			||||||
        public static ListNode GetListNode(ListNode head, int val)
 | 
					        public static ListNode? GetListNode(ListNode? head, int val)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            while (head != null && head.val != val)
 | 
					            while (head != null && head.val != val)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user