双黄包求hd moving coupon code# Living
p*2
1 楼
public void Add(Task task)
{
int i=0;
for(;i {
if(task.deadline
list.Insert(i,task);
break;
}
}
if(i==list.Count)
list.Add(task);
}
public void Add(Task task)
{
if (list.Count == 0)
{
list.Add(task);
return;
}
int start = 0;
int end = list.Count - 1;
while (start <= end)
{
if (start == end)
{
if (list[start].deadline > task.deadline)
list.Insert(start, task);
else
list.Insert(start + 1, task);
return;
}
int mid = (start + end) / 2;
if (list[mid].deadline == task.deadline)
{
list.Insert(mid, task);
return;
}
if (list[mid].deadline < task.deadline)
{
start = mid + 1;
}
else
{
end = mid - 1;
}
}
}
}
{
int i=0;
for(;i
if(task.deadline
list.Insert(i,task);
break;
}
}
if(i==list.Count)
list.Add(task);
}
public void Add(Task task)
{
if (list.Count == 0)
{
list.Add(task);
return;
}
int start = 0;
int end = list.Count - 1;
while (start <= end)
{
if (start == end)
{
if (list[start].deadline > task.deadline)
list.Insert(start, task);
else
list.Insert(start + 1, task);
return;
}
int mid = (start + end) / 2;
if (list[mid].deadline == task.deadline)
{
list.Insert(mid, task);
return;
}
if (list[mid].deadline < task.deadline)
{
start = mid + 1;
}
else
{
end = mid - 1;
}
}
}
}