_대문 | 방명록 | 최근글 | 홈피소개 | 주인놈
FrontPage › CSharp-연결리스트

Contents

[-]


구현해보려고 했으나.. 이미 구현해 놓은 템플릿(더블 링크드 리스트)이 있구나~~
윈엠프의 플레이 리스트.. 네트워크에서 데이터 패킷으로 나눠 전송하고 수신측에서 합칠 때 이런 자료구조를 사용한다.

using System;
using System.Collections.Generic;

namespace LinkedList
{
	class Program
	{
		public static void Main(string[] args)
		{
			LinkedList<String> test = new LinkedList<String>();
			test.AddLast("1");
			test.AddLast("2");
			test.AddLast("3");
			test.AddAfter(test.Find("2"), "2.5");
			test.Remove("1");
			
			int i = 1;
			foreach (String s in test)
			{
				Console.WriteLine( "링크드 리스트 {0}째 요소의 값은 {1}", i, s);
				i++;
			}
            
			Console.Write("Press any key to continue . . . ");
			Console.ReadKey(true);
		}
	}
}

/*
링크드 리스트 1째 요소의 값은 2
링크드 리스트 2째 요소의 값은 2.5
링크드 리스트 3째 요소의 값은 3
Press any key to continue . . .
*/

댓글 남기기..
이름: : 오른쪽의 새로고침을 클릭해 주세요. 새로고침
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:53

새로운 것들을 보는 것만이 중요한 게 아니다. (알베로니)