精品偷拍一区二区三区,亚洲精品永久 码,亚洲综合日韩精品欧美国产,亚洲国产日韩a在线亚洲

  • <center id="usuqs"></center>
  • 
    
  • give me an answer

    give me an answer
    class Program
    {
    static void Main(string[] args)
    {
    LinkedList list = new LinkedList();
    list.AddFirst(10);
    list.AddLast(20);
    list.AddLast(30);
    list.AddLast(40);
    The above program is incomplete,please complete the above program to perform following operations on linked list,the operations to be performed are:
    i.Display total number of nodes into the linked list
    ii.Add value :25 after 20.
    iii.Add value 5 before 10
    iv.Check that the list contains value 30,if contains display a message “30 is into the linked list”
    v.Display the values of all the nodes from the linked list.
    其他人氣:780 ℃時(shí)間:2020-04-07 16:39:47
    優(yōu)質(zhì)解答
    using System;
    using System.Collections.Generic;
    using System.Text;

    namespace LinkedListDemo
    {
    class Program
    {
    static void Main(string[] args)
    {
    LinkedList<int> list = new LinkedList<int>();

    list.AddFirst(10);
                list.AddLast(20);
                list.AddLast(30);
                list.AddLast(40);

    //i. Display total number of nodes into the linked list
    Console.WriteLine("Total number of nodes:{0}", list.Count);

    //ii. Add value : 25 after 20.
    list.AddAfter(list.Find(20), 25);

    //iii. Add value 5 before 10
    list.AddBefore(list.Find(10), 5);

    //iv. Check that the list contains value 30, if contains display a message “30 is into the linked list”
    if (list.Contains(30)) {
    Console.WriteLine("30 is into the linked list");
    }

    //v. Display the values of all the nodes from the linked list.
    foreach (int value in list) {
    Console.Write("{0} ", value);
    }

    Console.ReadKey();

    }
    }
    }

     

    我來回答
    類似推薦
    請(qǐng)使用1024x768 IE6.0或更高版本瀏覽器瀏覽本站點(diǎn),以保證最佳閱讀效果。本頁提供作業(yè)小助手,一起搜作業(yè)以及作業(yè)好幫手最新版!
    版權(quán)所有 CopyRight © 2012-2024 作業(yè)小助手 All Rights Reserved. 手機(jī)版