Каждая задача - один файл с соответствующим названием, запускаются они все из файла main через интерактивный ввод.
- Дана структура Human (с произвольным набором полей и методов). Реализовать встраивание методов в структуре Action от родительской структуры Human (аналог наследования)
- Написать программу, которая конкурентно рассчитает значение квадратов чисел взятых из массива (2,4,6,8,10) и выведет их квадраты в stdout
- Реализовать постоянную запись данных в канал (главный поток). Реализовать набор из N воркеров, которые читают произвольные данные из канала и выводят в stdout. Необходима возможность выбора количества воркеров при старте
- Программа должна завершаться по нажатию Ctrl+C. Выбрать и обосновать способ завершения работы всех воркеров
- Разработать программу, которая будет последовательно отправлять значения в канал, а с другой стороны канала — читать. По истечению N секунд программа должна завершаться
- Реализовать все возможные способы остановки выполнения горутины
- Реализовать конкурентную запись данных в map
- Дана переменная int64. Разработать программу, которая устанавливает i-й бит в 1 или 0
- Разработать конвейер чисел. Даны два канала: в первый пишутся числа (x) из массива, во второй — результат операции x*2, после чего данные из второго канала должны выводиться в stdout
- Дана последовательность температурных колебаний: -25.4, -27.0 13.0, 19.0, 15.5, 24.5, -21.0, 32.5. Объединить данные значения в группы с шагом в 10 градусов. Последовательность в подмножноствах не важна Пример: -20:{-25.0, -27.0, -21.0}, 10:{13.0, 19.0, 15.5}, 20: {24.5}, etc
- Реализовать пересечение двух неупорядоченных множеств
- Имеется последовательность строк - (cat, cat, dog, cat, tree) создать для нее собственное множество
- Поменять местами два числа без создания временной переменной
- Разработать программу, которая в рантайме способна определить тип переменной: int, string, bool, channel из переменной типа interface{}
-
К каким негативным последствиям может привести данный фрагмент кода, и как это исправить? Приведите корректный пример реализации
var justString string func someFunc() { v := createHugeString(1 << 10) justString = v[:100] } func main() { someFunc() }
- Реализовать быструю сортировку массива (quicksort) встроенными методами языка
- Реализовать бинарный поиск встроенными методами языка
- Реализовать структуру-счетчик, которая будет инкрементироваться в конкурентной среде. По завершению программа должна выводить итоговое значение счетчика
- Разработать программу, которая переворачивает подаваемую на ход строку (например: «главрыба — абырвалг»). Символы могут быть unicode
- Разработать программу, которая переворачивает слова в строке. Пример: «snow dog sun — sun dog snow»
- Реализовать паттерн «адаптер» на любом примере
- Разработать программу, которая перемножает, делит, складывает, вычитает две числовых переменных a,b, значение которых > 2^20
- Удалить i-ый элемент из слайса
- Разработать программу нахождения расстояния между двумя точками, которые представлены в виде структуры Point с инкапсулированными параметрами x,y и конструктором
- Реализовать собственную функцию sleep
- Разработать программу, которая проверяет, что все символы в строке уникальные (true — если уникальные, false etc). Функция проверки должна быть регистронезависимой. Например: abcd — true, abCdefAaf — false, aabcd — false
Each task is one file with the corresponding name, they are all launch from the main file through interactive input.
- The Human structure is given (with an arbitrary set of fields and methods). Implement embedding of methods in the Action structure from the parent Human structure (analogous to inheritance)
- Write a program that competitively calculates the value of the squares of numbers taken from the array (2,4,6,8,10) and outputs their squares to stdout
- Implement constant writing of data to the channel (main thread). Implement a set of N workers that read arbitrary data from a channel and output it to stdout. It is necessary to be able to select the number of workers at startup
- The program should end by pressing Ctrl+C. Select and justify a method for completing the work of all workers
- Develop a program that will sequentially send values to the channel, and read from the other side of the channel. After N seconds the program should exit
- Implement all possible ways to stop the execution of a goroutine
- Implement concurrent data recording in map
- An int64 variable is given. Develop a program that sets the i-th bit to 1 or 0
- Develop a number pipeline. Two channels are given: numbers (x) from the array are written into the first, the result of the operation x*2 is written into the second, after which the data from the second channel should be output to stdout
- The sequence of temperature fluctuations is given: -25.4, -27.0 13.0, 19.0, 15.5, 24.5, -21.0, 32.5. Combine these values into groups in 10 degree increments. The sequence in subsets is not important Example: -20:{-25.0, -27.0, -21.0}, 10:{13.0, 19.0, 15.5}, 20: {24.5}, etc
- Implement the intersection of two unordered sets
- There is a sequence of strings - (cat, cat, dog, cat, tree) create your own set for it
- Swap two numbers without creating a temporary variable
- Develop a program that can determine the type of variable in runtime: int, string, bool, channel from a variable of type interface{}
-
What negative consequences can this piece of code lead to, and how can I fix it? Please provide a correct implementation example
var justString string func someFunc() { v := createHugeString(1 << 10) justString = v[:100] } func main() { someFunc() }
- Implement quick array sorting (quicksort) using built-in language methods
- Implement binary search using built-in language methods
- Implement a counter structure that will be incremented in a competitive environment. Upon completion, the program should print the final counter value
- Develop a program that reverses the string supplied for the move (for example: “headfish - abyrvalg”). Characters can be unicode
- Develop a program that reverses words in a string. Example: “snow dog sun - sun dog snow”
- Implement the “adapter” pattern using any example
- Develop a program that multiplies, divides, adds, subtracts two numeric variables a,b, the value of which is > 2^20
- Remove the i-th element from the slice
- Develop a program for finding the distance between two points, which are represented as a Point structure with encapsulated parameters x,y and a constructor
- Implement your own sleep function
- Develop a program that checks that all characters in a string are unique (true if unique, false etc). The check function must be case insensitive. For example: abcd - true, abCdefAaf - false, aabcd - false