Skip to content

Conversation

@mskmrv
Copy link
Owner

@mskmrv mskmrv commented May 24, 2019

Реализовал стек и очередь. Двусторонняя очередь - в работе.

Copy link

@OKrylov OKrylov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Решения по стеку и очереди принимаются, рад увидеть другую реализацию на основе предыдущего материала.
1 и 2 задачи зачет, будут ждать дек.
Если остались вопросы - пишите

return value;
}

private void remove(int index) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно было вызывать super.remove(index), эффект был бы тот же

throw new RuntimeException("Queue is empty");
}
E value = peek();
super.remove(value);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Получаем очень неэффективное удаление из-за большого количества сдвигов, поэтому решение с метками здесь более оптимально

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants