a.homepage:link, a.homepage:visited {
...
}
This is basically setting the CSS rule for an anchor (link) in the class homepage in two stages,
#include <iostream> | |
#include <locale> | |
int main() | |
{ | |
std::locale loc("de_DE"); | |
auto& facet = std::use_facet<std::messages<char>>(loc); | |
const char* dir = "/usr/share/gcc-data/x86_64-pc-linux-gnu/4.6.1/locale"; | |
auto cat = facet.open("libstdc++", loc, dir); | |
std::cout << "\"please\" in German: " | |
<< facet.get(cat, 0, 0, "please") << '\n' |
void Graph::printSCCs() | |
{ | |
stack<int> Stack; | |
bool *visited = new bool[V]; | |
for(int i = 0; i < V; i++) | |
visited[i] = false; | |
for(int i = 0; i < V; i++) | |
if(visited[i] == false) | |
fillOrder(i, visited, Stack); | |
Graph gr = getTranspose(); |
#include <iostream> | |
#include "queue.cpp" | |
using namespace std; | |
const int INFINITY = 999; | |
class graph | |
{ | |
class vertex | |
{ | |
public: |
#include <iostream> | |
using namespace std; | |
template <class etype> | |
class queue | |
{ | |
class qnode | |
{ | |
public: | |
etype element; |
#include <iostream> | |
#include <cstdlib> | |
using namespace std; | |
// Assuming all the treap structure is correct. | |
//------------Rotations--------------------------------------------- | |
/* RR(Y rotates to the right): | |
k2 k1 | |
/ \ / \ | |
k1 Z ==> X k2 |
/* $NetBSD: curses.h,v 1.103.2.1 2012/05/23 10:07:31 yamt Exp $ */ | |
/* | |
* Copyright (c) 1981, 1993, 1994 | |
* The Regents of the University of California. All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* 1. Redistributions of source code must retain the above copyright |
For the base case we have something a little less trivial since our smallest merge will have k elements in it, which for a large data set could have 10 to 50 partitions OR MORE. To solve this we can sort by putting them in to a heap real quick and pulling them back out, in the given source code below, I didn't write the heap, but it's pretty trivial to do so.
if (high < low + k) {
// the subarray has k or fewer elements
// just make one big heap and do deleteMins on it
Comparable[] subarray = new MergesortHeapNode[high - low + 1];
for (int i = 0, j = low; i < subarray.length; i++, j++) {
subarray[i] = new MergesortHeapNode(data[j], 0);
}
This is the algorithm you could be using for a Bottom Up, Non recursive method to write mergesort. Its faster. If you wish to see the time difference between both. Use the functions from the header file or to calculate and you'll see Iteration is faster. Though it could be slightly maddening near the end of the algorithm, give it a shot. Prior to invoking this algorithm run a sort for the first two elements of the array i.e array[0] and array[1] Time complexity O(nlogn)
FUNCTION MERGESORT(A, length)
IF length < 2 THEN
//RETURN everything because THE ARRAY IS ALREADY SORTED
RETURN
jump := 1
WHILE jump < length DO
startL := 0