Skip to content

Instantly share code, notes, and snippets.

View prrs's full-sized avatar

Ravi shanker prrs

View GitHub Profile
@prrs
prrs / changing_bits.cpp
Created February 11, 2012 18:45
interviewstreet
#include<stdio.h>
#include<string.h>
#include<ctype.h>
void inline polyadd(unsigned short int A[],unsigned short int B[],unsigned short int C[], int);
void inline display(unsigned short int A[],int);
void inline polyset(unsigned short int A[],int,int);
int main()
{
unsigned short int A[6250]={0};
unsigned short int B[6250]={0};
/**
* In this code we have a very large array called arr, and very large set of operations
* Operation #1: Increment the elements within range [i, j] with value val
* Operation #2: Get max element within range [i, j]
* Build tree: build_tree(1, 0, N-1)
* Update tree: update_tree(1, 0, N-1, i, j, value)
* Query tree: query_tree(1, 0, N-1, i, j)
*/
#include<iostream>
/**
* In this code we have a very large array called arr, and very large set of operations
* Operation #1: Increment the elements within range [i, j] with value val
* Operation #2: Get max element within range [i, j]
* Build tree: build_tree(1, 0, N-1)
* Update tree: update_tree(1, 0, N-1, i, j, value)
* Query tree: query_tree(1, 0, N-1, i, j)
*/
#include<iostream>