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:
commit
3339a648d0
@ -45,7 +45,7 @@ namespace hello_algo.chapter_array_and_linkedlist
|
||||
Console.WriteLine("在索引 3 处插入数字 6 ,得到 list = " + string.Join(",", list));
|
||||
|
||||
/* 删除元素 */
|
||||
list.Remove(3);
|
||||
list.RemoveAt(3);
|
||||
Console.WriteLine("删除索引 3 处的元素,得到 list = " + string.Join(",", list));
|
||||
|
||||
/* 通过索引遍历列表 */
|
||||
|
@ -10,7 +10,7 @@ namespace hello_algo.include
|
||||
public class ListNode
|
||||
{
|
||||
public int val;
|
||||
public ListNode next;
|
||||
public ListNode? next;
|
||||
|
||||
/// <summary>
|
||||
/// Generate a linked list with an array
|
||||
@ -26,7 +26,7 @@ namespace hello_algo.include
|
||||
/// </summary>
|
||||
/// <param name="arr"></param>
|
||||
/// <returns></returns>
|
||||
public static ListNode ArrToLinkedList(int[] arr)
|
||||
public static ListNode? ArrToLinkedList(int[] arr)
|
||||
{
|
||||
ListNode dum = new ListNode(0);
|
||||
ListNode head = dum;
|
||||
@ -44,7 +44,7 @@ namespace hello_algo.include
|
||||
/// <param name="head"></param>
|
||||
/// <param name="val"></param>
|
||||
/// <returns></returns>
|
||||
public static ListNode GetListNode(ListNode head, int val)
|
||||
public static ListNode? GetListNode(ListNode? head, int val)
|
||||
{
|
||||
while (head != null && head.val != val)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user