Skip to content

Instantly share code, notes, and snippets.

View rosiu's full-sized avatar

羊圈里最帅的狼 rosiu

View GitHub Profile
// Please write an sequence list implements the interface with the required
// time complexity described in the comments. The users can add the same
// element as many times as they want, but it doesn't support the null item.
// You can use any types in .NET BCL but cannot use any 3rd party libraries.
// PS: You don't need to consider the multi-threaded environment.
interface IMyList<T> : IEnumerable<T>
{
// O(1)
// Add an item at the beginning of the list.
void AddFirst(T item);
@rosiu
rosiu / MyList.cs
Created March 28, 2012 05:06
用数组去实现的,为了删除方便,定义了一个索引器.
using System;
using System.Collections;
using System.Collections.Generic;
namespace TESTESTE
{
public class MyList<T> : IMyList<T>
{
private T[] _data;