This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{What is the capital of Bulgaria?, Sofia,[]} | |
{What is three times three minus 8, 1,[]} | |
{Who let the dogs out, who,[]} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example program | |
#include <iostream> | |
#include <string> | |
class X | |
{ | |
int x; //private | |
int y; // private | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def handle_cast({:create, name}, names) do | |
if Map.has_key?(names, name) do | |
{:noreply, names} | |
else | |
{:ok, bucket} = KV.Bucket.start_link | |
{:noreply, Map.put(names, name, bucket)} | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <assert.h> | |
const int NUM_SYSTEM = 2; | |
char arr[] = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P','Q','R','S','T','U','V','W', 'X','Y', 'Z' }; | |
char* DecToNumSystem(unsigned int num) | |
{ | |
assert(NUM_SYSTEM > 1); | |
int size = std::floor(log(num) / log(NUM_SYSTEM)) + 1; | |
char* res = new char[size]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
struct node; | |
class Queue | |
{ | |
public: | |
Queue(); | |
~Queue(); | |
public: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
struct node; | |
class Stack | |
{ | |
public: | |
Stack(); | |
~Stack(); | |
public: | |
bool push(int); | |
bool pop(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#ifndef __MEMORY_ALLOCATOR_H__ | |
#define __MEMORY_ALLOCATOR_H__ | |
/*! \file MemoryAllocator.h | |
\brief Header file for the memory allocator. | |
@author Ivan Aleksandrov Ivanov | |
@version 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "MemoryAllocator.h" | |
#include <iostream> | |
#include <exception> | |
#include <new> | |
#include <assert.h> | |
#include <algorithm> | |
// ALWAYS a power of 2 !!! | |
const int ALIGNMENT = 8; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include "CppUnitTest.h" | |
#include "../MemoryAllocator/MemoryAllocator.h" | |
#include "../MemoryAllocator/MemoryAllocator.cpp" | |
using namespace Microsoft::VisualStudio::CppUnitTestFramework; | |
BEGIN_TEST_MODULE_ATTRIBUTE() | |
TEST_MODULE_ATTRIBUTE(L"Project", L"UnitTests") | |
TEST_MODULE_ATTRIBUTE(L"Date", L"24/01/2016") | |
END_TEST_MODULE_ATTRIBUTE() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//IMHO using Class for this task is an overkill | |
//So I am using just one struct and a few functions to operate with it | |
//NOTE: The input must start with ( and the first digit of the root must be at position 1 !!! | |
#include <iostream> | |
#include <vector> | |
#include <stack> | |
#include <string> | |
#include <algorithm> |