This file contains 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
var EventManager = function() { | |
this.initialize(); | |
}; | |
// place properties here | |
// Constructor | |
EventManager.prototype = { | |
initialize: function() { | |
//declare listeners as an object | |
this.listeners = {}; | |
}, |
This file contains 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
int getLeafCount(struct Node node) | |
{ | |
if(node == null) | |
return 0; | |
if(node.left == null && node.right==null) | |
return 1; | |
else | |
return getLeafCount(node.left)+ | |
getLeafCount(node.right); | |
} |
This file contains 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
public class SearchInRotatedArray { | |
public static void main(String[] args) { | |
System.out.println("Search in rotated Array"); | |
int[] a = { 5, 6, 7, 1, 2, 3, 4 }; | |
System.out.println(rotated_binary_search(a, 6)); | |
} | |
private static int rotated_binary_search(int A[], int key) { |
This file contains 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.util.*; | |
import java.lang.*; | |
import java.io.*; | |
class OccurenceOfElementInSortedArray | |
{ | |
static int findfirst(int arr[],int start,int end,int n,int no) |
This file contains 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
public static int getDiameter(BinaryTreeNode root) { | |
if (root == null) | |
return 0; | |
int rootDiameter = getHeight(root.getLeft()) + getHeight(root.getRight()) + 1; | |
int leftDiameter = getDiameter(root.getLeft()); | |
int rightDiameter = getDiameter(root.getRight()); | |
return Math.max(rootDiameter, Math.max(leftDiameter, rightDiameter)); | |
} |
This file contains 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
public static int[] merge(int[] a, int[] b) { | |
int[] answer = new int[a.length + b.length]; | |
int i = 0, j = 0, k = 0; | |
while (i < a.length && j < b.length) | |
{ | |
if (a[i] < b[j]) | |
answer[k++] = a[i++]; |
This file contains 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
public SingleLinkedList reverseRecursive(SingleLinkedList head) { | |
ListNode current = head; | |
if(current == null || current.next ==null) return current; | |
ListNode next= current.next; | |
current.next = null; | |
ListNode r = reverseList(next); | |
This file contains 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
<?php | |
require("class-IXR.php"); | |
$client = new IXR_Client('http://domain.com/xmlrpc.php'); | |
$USER = 'rrrr'; | |
$PASS = 'rrrr'; | |
// if (!$client->query('wp.getCategories','', $USER,$PASS)) | |
// { | |
// echo('Error occured during category request.' . $client->getErrorCode().":".$client->getErrorMessage()); |
This file contains 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
<?php | |
require("class-IXR.php"); | |
function create($client, $USER,$PASS,$title,$desc){ | |
$content['title'] = $title; | |
$content['description'] = $desc; | |
if (!$client->query('metaWeblog.newPost','', $USER,$PASS, $content, false)) | |
{ |
This file contains 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
<?php | |
/** | |
* IXR - The Incutio XML-RPC Library | |
* | |
* Copyright (c) 2010, Incutio Ltd. | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* |