• Добро пожаловать в Пиратскую Бухту! Чтобы получить полный доступ к форуму пройдите регистрацию!
  • Гость, стой!

    В бухте очень не любят флуд и сообщения без смысловой нагрузки!
    Чтобы не получить бан, изучи правила форума!

    Если хотите поблагодарить автора темы, или оценить реплику пользователя, для этого есть кнопки: "Like" и "Дать на чай".

 Код C#

N0rya

Юнга
Читатель
Регистрация
22.12.19
Сообщения
41
Онлайн
2д 2ч 37м
Сделки
0
Нарушения
1 / 2
Всем привет! Кто мог бы помочь по данным пунктам с кодом? Как его напсиать
a) Write a function create_random_list( N, max ) that takes two integer values ‘N’ and ‘max’ as arguments and returns a linked list with N elements such that the elements have values in the range 0 to max.
b) Write a function sum( list ) that takes a list and returns the sum of the numbers stored in its nodes.
c) Add a variable to the head of the list that keeps track of how many elements the list has each time an element is added or removed. Write a function size( list ) that computes the length of a list using this variable.
d) Write a function that adds a node at the end of a list.
e) Write a function that removes the last node of a list.
f) Write a function that removes the second last node of a list.
g) Write a function reverse( list ) that takes a list and returns a reversed copy.
h) Write a function copy( list ) that takes a list and returns a copy of it.
i) Add a reference to the last node in a list to the list head that keeps track of the reference of the last node whenever a node is appended or removed.
j) Implement a list that does not hold integers, but lists of integers. You only need to implement the class structures and a function that inserts at the head.
 
Сверху