mirror of
https://github.com/krahets/hello-algo.git
synced 2026-10-24 06:55:19 +08:00
fix: sync array, deque, and printing fixes across translations (#1973)
Synchronize the fixes from #1936, #1824, and #1961 across translated editions and normalize C# and Dart formatting. Move Java CI to Ubuntu 24.04 so its Java 11/17 checks can run.
This commit is contained in:
@@ -74,26 +74,28 @@ public class LinkedListDeque {
|
||||
if (IsEmpty())
|
||||
throw new Exception();
|
||||
int? val;
|
||||
// Если в очереди один элемент, начало и конец указывают на один узел
|
||||
if (queSize == 1) {
|
||||
val = front!.val;
|
||||
front = null;
|
||||
rear = null;
|
||||
}
|
||||
// Операция извлечения из головы очереди
|
||||
if (isFront) {
|
||||
val = front?.val; // Временно сохранить значение головного узла
|
||||
else if (isFront) {
|
||||
val = front!.val; // Временно сохранить значение головного узла
|
||||
// Удалить головной узел
|
||||
ListNode? fNext = front?.next;
|
||||
if (fNext != null) {
|
||||
fNext.prev = null;
|
||||
front!.next = null;
|
||||
}
|
||||
fNext!.prev = null;
|
||||
front.next = null;
|
||||
front = fNext; // Обновить головной узел
|
||||
}
|
||||
// Операция извлечения из хвоста очереди
|
||||
else {
|
||||
val = rear?.val; // Временно сохранить значение хвостового узла
|
||||
val = rear!.val; // Временно сохранить значение хвостового узла
|
||||
// Удалить хвостовой узел
|
||||
ListNode? rPrev = rear?.prev;
|
||||
if (rPrev != null) {
|
||||
rPrev.next = null;
|
||||
rear!.prev = null;
|
||||
}
|
||||
rPrev!.next = null;
|
||||
rear.prev = null;
|
||||
rear = rPrev; // Обновить хвостовой узел
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user