Skip to content

Instantly share code, notes, and snippets.

View sudheesh001's full-sized avatar

Sudheesh Singanamalla sudheesh001

View GitHub Profile
@sudheesh001
sudheesh001 / Treap.cpp
Created September 19, 2013 03:19
Treap implementation in C++
#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
@sudheesh001
sudheesh001 / keybase.md
Created February 17, 2019 10:58
Keybase Verification

Keybase proof

I hereby claim:

  • I am sudheesh001 on github.
  • I am sudheesh (https://keybase.io/sudheesh) on keybase.
  • I have a public key whose fingerprint is FAA0 909D 5262 3DBC F04D 4A01 1038 EE98 5FB9 0590

To claim this, I am signing this object:

@sudheesh001
sudheesh001 / queue.cpp
Created October 18, 2013 07:44
C++ implementation of queue
#include <iostream>
using namespace std;
template <class etype>
class queue
{
class qnode
{
public:
etype element;
@sudheesh001
sudheesh001 / MergeSort.md
Created July 7, 2013 11:20
Algorithm for Iterative Merge Sort

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
@sudheesh001
sudheesh001 / templates.js
Created August 8, 2016 15:57
Sometimes when things break on loklak webclient
angular.module("templates", []).run(["$templateCache", function($templateCache) {$templateCache.put("about.html","<div class=\"content-wrapper\">\n <div class=\"container about-view-container \">\n <div class=\"row cms-view\">\n <div class=\"col-md-12 about-jumbotron\">\n <h1 class=\"page-header\">About <code>loklak</code></h1>\n <p>This is the front-end of <code>Loklak</code>, an application which is able to collect and analyse messages from various sources, including Twitter. The application is divided into two parts: <a href=\"http://loklak.net\"><code>loklak</code>.net</a>, the front-end (these pages) and <a href=\"http://loklak.org\"><code>loklak</code>.org</a>, the search- and collecting back-end.</p>\n <img src=\"../images/loklak_architecture_overview.png\" width=\"50%\" height=\"50%\">\n\n <p>The back-end is not only able to collect millions of messages anonymously from Twitter, it can also distribute the collection workload into a peer-to-peer network.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Lets Drag a Marker Ria</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
<script type="text/javascript">
var map = null;
function getMap()
@sudheesh001
sudheesh001 / scalingo_loklak_fail.log
Created May 2, 2016 07:51
Loklak server log for scalingo deployments
<-- Start deployment of loklak-server-alpha -->
-----> Cloning custom buildpack: 'https://github.com/aneeshd16/heroku-buildpack-ant-loklak.git'
-----> Installing Apache Ant 1.9.3..... [start]
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 5399k 100 5399k 0 0 10.6M 0 --:--:-- --:--:-- --:--:-- 10.6M
-----> Installing Apache Ant 1.9.3..... [done ]!
-----> executing /build/98a92a58ab12d204bd7ca28ebbcf264f/.buildpack/apache-ant-1.9.3/bin/ant -Duser.home=/build/98a92a58ab12d204bd7ca28ebbcf264f
@sudheesh001
sudheesh001 / messages.cpp
Created January 10, 2014 03:07
Messages and Locales are used in localization of content.
#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'
@sudheesh001
sudheesh001 / Working method.md
Created December 1, 2013 18:35
Easy Understanding of Pseudo-classes selectors in CSS3

Explanation to the working.

a.homepage:link, a.homepage:visited {
   ...
   }

This is basically setting the CSS rule for an anchor (link) in the class homepage in two stages,

@sudheesh001
sudheesh001 / SingleDFS.cpp
Created November 21, 2013 05:21
Strongly Connected Components using single DFS. Print Code segment.
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();