Skip to content

Instantly share code, notes, and snippets.

#include<iostream>
#include<cstdio>
#include<vector>
#define SIZE 2
using namespace std;
int main(){
const char *animal[] = {"Dog","Cat"};
@bitwiser
bitwiser / poly.c
Last active August 29, 2015 13:57
#include<stdio.h>
#include<stdlib.h>
double f(double c3,double c2,double c1,double c0,double x){
double f = c3*x*x*x + c2*x*x + c1*x + c0;
return f;
}
int main(){
char *poly = "C3*x^3 + C2*x^2 + C1*x + C0";
Methods of analysis
To be able to predict the time without having to look at the details of the input, we measure it as a function of the length of the input. Here x has basically constant length (depending on what an item is) and the length of L is just the number of items in it.
So given a list L with n items, how many comparisons does the algorithm take? Answer: it depends.
We want an answer that doesn't depend. There are various ways of getting one, by combining the times for different inputs with the same length.
Worst case analysis -- what is the most comparisons we could ever see no matter how perverse the input is?
time_wc(n) = max time(I)
(input I of size n)
@bitwiser
bitwiser / BingImageOfTheday.py
Created March 4, 2014 07:21
Download Bing Image of the Day
import os
import sys
import urllib2
import json
import threading
import time
BING = {
"base": "http://bing.com",
"wall": "/HPImageArchive.aspx?format=js&idx=0&n=1&nc=1393792328465&pid=hp&video=1"
import java.util.*;
public class TimeComparer
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Please enter the first time in military time (hour minute): ");
int hour1 = in.nextInt();
@bitwiser
bitwiser / google_app_script.js
Last active June 2, 2021 22:04
Email Google Form Spreadsheet data as Attachment using Google Script
/*
* author: bitwiser
* for complete tutorial, visit: http://bitwiser.in/2014/04/22/email-google-form-data-as-pdf.html
*/
var START_ROW = 2;
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
<!doctype html>
<html>
<head>
<title>BuzzButtons</title>
<style>
.error{
color: red;
}
</style>
</head>
Cascading Style Sheets (CSS) is a style sheet language used for describing the look and formatting of a document written in a markup language. While most often used to style web pages and interfaces written in HTML and XHTML, the language can be applied to any kind of XML document, including plain XML, SVG and XUL.
1.
<html>
<head><title>1</title></head>
<body style="background-image: url('image.jpg')">
Body
</body
<?php
//Excersice 1
function getextension($file){
$path = pathinfo($file);
return $path['extension'];
}
$music = "";
#include<iostream>
#include<stack>
#include<queue>
using namespace std;
bool checkBalancedParentheses(string s){
stack<char> st;
for(int i=0;i<s.length();i++){
if(s[i]=='('){
st.push(s[i]);