Skip to content

Instantly share code, notes, and snippets.

@zindmax
zindmax / Alg.cpp
Last active January 13, 2022 18:01
LZW
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
bool contains(map<string, int> dic, int x) {
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
bool is_valid(vector<int> numb) {
int sum = 0;
import string
scheme =["0", "10", "1100", "1101", "1110" ,"1111"]
str = "abcdef"
code = ""
inp_str = "abccdf"
for x in inp_str:
ind = str.find(x)
print(scheme[ind], end ="")
code += scheme[ind]
@zindmax
zindmax / 1.cpp
Last active January 12, 2022 10:44
task 8
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
double calcHi(vector<double> P_i) {
double h_i = 0;
for (double i : P_i) {
if (i == 0) {
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
double calcHi(vector<double> P_i) {
double h_i = 0;
for (double i : P_i) {
if (i == 0) {
@zindmax
zindmax / task 6.cpp
Last active December 23, 2021 18:28
class Base {
public int x = 0;
}
class Child extends Base{
public int x = 1;
}
public class Main
{
@zindmax
zindmax / 4.cpp
Last active December 23, 2021 18:28
lab 8
#include <iostream>
using namespace std;
class stack {
int *data;
int size;
int count = 0;
public:
stack(int _size) : size(_size) {
@zindmax
zindmax / tak 3.cpp
Last active December 23, 2021 18:28
Lab 8
#include <iostream>
#include <string>
using namespace std;
class foo {
private:
int x;
public:
int y;
@zindmax
zindmax / task 14.py
Last active December 23, 2021 18:28
lab_7
def myfunc1():
x = "John"
def myfunc2():
nonlocal x
x = "hello"
myfunc2()
return x
print(myfunc1())
#include <iostream>
using namespace std;
int main()
{
// массив указателей
int **x;
int n = 5, m = 4;
x = new int *[n];