Efficient algorithms - Lecture 5


Prev Next
Topic: STL

STL

The STL is a library that contains implementations of basic data structures and allows them to be used in other programs.
You can find the STL documentation here: http://www.cplusplus.com/reference/stl/.

Warsaw's headers

The world champions in team programming have developed a set of headings that can be used in assignments. Here it is:
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;
typedef pair <int,int> PII;
#define MP make_pair
#define FOR(v,p,k) for(int v=p;v<=k;++v)
#define FORD(v,p,k) for(int v=p;v>=k;--v)
#define REP(i,n) for(int i=0;i<(n);++i)
#define VAR(v,i) __typeof(i) v=(i)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();++i)
#define PB push_back
#define ST first
#define ND second
#define SIZE(x) (int)x.size()
#define ALL(c) c.begin(),c.end()
  

Buckets tower:

An example of using a stack in the Buckets Tower task:
  #include <stack>
  #include <vector>

  ...

  stack<Structure> Stos;
  // Structure - structure in which you can store items used on the stack.;
  

Tasks:

Transform the Expression
Easy Queue
Smallest on the Stack
Bucket tower