This file contains hidden or 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
/* | |
* Assumptions/Limitations: | |
* 1. gcc compiler is used. | |
* 2. byte is 8 bits long.(sizeof(char)==1) | |
* 3. word is 32 bits long.(sizeof(int)==4) | |
* 4. dword is 64 bits long. | |
*/ | |
#include "assert.h" | |
#include "stdio.h" | |
#include "string.h" |
This file contains hidden or 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
pre { | |
margin-left: 2em; | |
background-color: #f8f8ff; | |
font-size: 11px; | |
padding: 3px 5px; | |
-moz-border-radius: 4px; | |
-webkit-border-radius: 4px; | |
-o-border-radius: 4px; | |
-ms-border-radius: 4px; | |
-khtml-border-radius: 4px; |
This file contains hidden or 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
import java.io.*; | |
class Rational | |
{ | |
/* | |
* Object oriented concept is misused here. Rational class doesn't need a | |
* isPrime() method. isPrime() should ideally come under the Integer class | |
*/ | |
boolean isPrime(int n) // Java has boolean datatype | |
{ | |
if(n < 2) // Remember, Prime numbers starts from 2 |
This file contains hidden or 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<stdio.h> | |
#include<stdlib.h> | |
typedef struct node { | |
int val; | |
struct node *next; | |
}List; | |
int Length(List *head) | |
{ | |
int len=0; |
This file contains hidden or 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
The MIT License (MIT) | |
Copyright (c) 2015 J Kishore Kumar | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
This file contains hidden or 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<stdio.h> | |
//#include<string.h> | |
//#define YYSTYPE char * | |
#define yyerror(X) printf(X) | |
%} | |
%% | |
START: A 'c' B {printf("AND");} | |
; | |
A: 'a' {printf("alpha");} |
This file contains hidden or 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<stdio.h> | |
#include<string.h> | |
#define MAX_COLUMN_COUNT 256 | |
#define STARTING_PK 1 | |
#define MODEL_NAME "sample.model" | |
typedef enum {false,true} bool; | |
int noc=0,pk=STARTING_PK-1,ci=0; | |
bool is_header=true,is_first_record=true,read_column_name=true,read_column_value=false,write_new_record=false; |
This file contains hidden or 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<stdio.h> | |
#include<stdlib.h> | |
#define ARRAY_SIZE 15 | |
typedef enum {false, true} bool; | |
int leng(char *ipstr) | |
{ | |
int i = 0; | |
while(ipstr[i] != '\0') | |
i++; | |
return i; |
This file contains hidden or 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
''' Python Script to show changes to Stages ''' | |
STAGE = 12 # content_type id differs from one database copy to another | |
from stages.models import Stage | |
from reversion.models import Version | |
[[Stage.objects.get(pk=s.object_id).display_name,s.revision.date_created.__str__()] for s in Version.objects.filter(revision__user__isnull = False).filter(content_type=STAGE)] |
This file contains hidden or 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
import sys | |
count=0 | |
sys.setrecursionlimit(50000) | |
cache={} | |
def a(m,n): | |
global count | |
global cache | |
count=count+1 | |
if cache.has_key(m) and cache[m].has_key(n): | |
return cache[m][n] |