RUVIDEO
Поделитесь видео 🙏

Java Practice-It || 16.8 switchPairs (pt.2) || implementing, ListNodes, LinkedLists, recursion

Question:
Write a method switchPairs that switches the order of elements in a linked list of integers in a pairwise fashion. Your method should switch the order of the first two values, then switch the order of the next two, switch the order of the next two, and so on. For example, if the list initially stores these values:

[3, 7, 4, 9, 8, 12]
Your method should switch the first pair (3, 7), the second pair (4, 9), the third pair (8, 12), etc. to yield this list:

[7, 3, 9, 4, 12, 8]
If there are an odd number of values, the final element is not moved. For example, if the list had been:

[3, 7, 4, 9, 8, 12, 2]
It would again switch pairs of values, but the final value (2) would not be moved, yielding this list:

[7, 3, 9, 4, 12, 8, 2]
Assume that we are adding this method to the LinkedIntList class as shown below. You may not call any other methods of the class to solve this problem, you may not construct any new nodes, and you may not use any auxiliary data structures to solve this problem (such as an array, ArrayList, Queue, String, etc.). You also may not change any data fields of the nodes. You must solve this problem by rearranging the links of the list.

public class LinkedIntList {
private ListNode front;
...
}

public class ListNode {
public int data;
public ListNode next;
...
}

Problem: https://practiceit.cs.washington.edu/problem/view/bjp5/chapter16/e8-switchPairs

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Java Practice-It || 16.8 switchPairs (pt.2) || implementing, ListNodes, LinkedLists, recursion», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.