Skip to content

Instantly share code, notes, and snippets.

View mgechev's full-sized avatar
🚀
Better Web

Minko Gechev mgechev

🚀
Better Web
View GitHub Profile
@mgechev
mgechev / polynomials.hs
Last active December 19, 2015 07:19
Simple sum of polynomials.
--Дефинирайте функция на Haskell, която намира сумата на два полинома, зададени във вида
--[(<коеф.1>,<степен1>),(<коеф.2>,<степен2>), . . . ,(<коеф.n>,<степенn>)],
--където всички коефициенти са различни от 0 реални числа и степенните показатели
--са подредени в строго намаляващ ред (резултатът трябва да има същия вид).
--It should also work with with coeficients equals to zero.
polynomialSum :: [(Integer, Integer)]->[(Integer, Integer)]->[(Integer, Integer)]
polynomialSum [] [] = []
polynomialSum [] l2 = l2
polynomialSum l1 [] = l1
@mgechev
mgechev / binary-search-tree-cpp.cpp
Last active October 3, 2022 03:54
Simple implementation of binary search tree in C++.
#include <iostream>
#include <math.h>
using namespace std;
template <class T>
struct Node {
T value;
Node *left;
Node *right;
@mgechev
mgechev / interesting-nodes.hs
Last active December 19, 2015 05:59
Finds the count of all interesting nodes in a binary tree (i.e. count of all nodes which has value equal to the count of their children)
data Tree = Nil | Node Int Tree Tree deriving (Eq)
interestingNodesCount Nil = 0
interestingNodesCount (Node a Nil Nil) = if a == 0 then 1 else 0
interestingNodesCount (Node a left right)
| left /= Nil && right == Nil && a == 1 = 1 + interestingNodesCount left
| left == Nil && right /= Nil && a == 1 = 1 + interestingNodesCount right
| left /= Nil && right == Nil && a /= 1 = 0 + interestingNodesCount left
| left == Nil && right /= Nil && a /= 1 = 0 + interestingNodesCount right
| otherwise = (if a == 2 then 1 else 0) + (interestingNodesCount left) + (interestingNodesCount right)
reverse2 :: [a]->[a]
reverse2 [] = []
reverse2 (x:xs) = (reverse2 xs) ++ [x]
len :: [a]->Int
len [] = 0
len (x:xs) = (len xs) + 1
sum2 :: [Int]->Int
sum2 [] = 0
@mgechev
mgechev / sample-solutions-DI-2010-IS.cpp
Created June 19, 2013 16:42
Solutions of the C++ problems of the sample final exam 2010 IS.
#include <iostream>
#include <string.h>
using namespace std;
class Trip {
private:
char *destination;
char *description;
int length;
double price;
@mgechev
mgechev / basic-tcp-server.dart
Created June 17, 2013 15:55
Basic TCP server in Dart
import 'dart:core';
import 'dart:async';
import 'dart:io';
void startServer() {
Future<ServerSocket> serverFuture = ServerSocket.bind('0.0.0.0', 55555);
serverFuture.then((ServerSocket server) {
server.listen((Socket socket) {
socket.listen((List<int> data) {
String result = new String.fromCharCodes(data);
--List length
len :: [a] -> Integer
len [] = 0
len (x:xs) = 1 + len xs
--Fibonacci
fib :: Integer -> Integer
fib 1 = 0
fib 2 = 1
fib 3 = 1
@mgechev
mgechev / record.pl
Last active December 16, 2015 12:18
Basic tool for screen recording via ffmpeg
#!/usr/bin/perl
use strict;
use warnings;
sub get_resolution {
my $resolution = `xdpyinfo | grep dimensions`;
if ($resolution =~ /dimensions:\s+(\d+)x(\d+)/) {
return { width => $1, height => $2 };
}
\documentclass[12pt]{beamer}
\usetheme{Singapore}
\usecolortheme{seagull}
\beamertemplatenavigationsymbolsempty
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}

#Schedule for ASP.NET exercises

  1. Introduction
  • Introduction to the course
  • What will be the course project
  • Course's web page
  • What kind of language is C#?
  • Hello world application with ASP.NET
  1. Introduction to C#
  • Fundamental constructs (loops, if-else-then, switch)