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
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
char * numbers = "12 156 101"; | |
for (int i = 0; *numbers != NULL; i++) | |
printf("%d : %ld\n", i, strtol(numbers, &numbers, 10)); | |
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
#include <stdio.h> | |
void printBinary(int); | |
int toInt(int*, char[]); | |
int handleProgram(char[]); | |
int main(int argc, char *argv[]) | |
{ | |
return handleProgram(argv[1]); | |
} |
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
#include <stdio.h> | |
typedef enum { FALSE, TRUE } boolean; | |
boolean isLeapYear(int); | |
char* getLeapInfo(int); | |
int main() | |
{ | |
for(int i = 1980; i <= 2017; 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 class GameOfLifeDemoV2 { | |
private static final int HEIGHT = 10; | |
private static final long PERIOD = 120*1; | |
public static void main(String[] args) throws InterruptedException { | |
boolean [][] matrix = new boolean[HEIGHT][HEIGHT]; | |
// generateRandom(matrix); // random values matrix | |
// testGlider(matrix); // test for Glider | |
testTumbler(matrix); // test for Tumbler |
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 GameOfLifeDemo { | |
private static final int HEIGHT = 10; | |
private static final long PERIOD = 120*1; | |
public static void main(String[] args) throws InterruptedException { | |
boolean [][] matrix = new boolean[HEIGHT][HEIGHT]; | |
// generateRandom(matrix); // random values matrix | |
// testGlider(matrix); // test for Glider | |
testTumbler(matrix); // test for Tumbler |
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.Arrays; | |
public class InPlaceSwapDemo { | |
public static void main(String[] args) { | |
int[] numbers = {3, 7}; | |
char[] str = {'b', 'z'}; | |
System.out.println("int In-Place Swap"); | |
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 SimpleGOL { | |
private static final int HEIGHT = 80; | |
private static final int CLEAR_SPACE = 2; | |
public static void main(String[] args) throws InterruptedException { | |
boolean [][] matrix = new boolean[HEIGHT][HEIGHT]; | |
boolean [][] tempMatrix = new boolean[HEIGHT][HEIGHT]; | |
for(int i = 0; i < matrix.length; 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 class EqualsOrOperatorDemo { | |
public static void main(String[] args) { | |
String str1 = "Hello"; | |
String[] strArray = new String[] { "animal", "donkey", new String("Hell") + new String("o"), "ox" }; | |
if( str1 == strArray[2] ) | |
System.out.println(" == Operator says : " + str1 + " = " + strArray[2]); | |
else | |
System.out.println(" == Operator says : " + str1 + " != " + strArray[2]); | |
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
package com.levo.hashing; | |
public class HashForLong { | |
public static void main(String[] args) { | |
long longValueOne = new Long(Integer.MAX_VALUE) + new Long(Integer.MAX_VALUE) + new Long(10); | |
long longValueTwo = 8; | |
// Following hashing function is not working, different numbers return same result | |
System.out.println("Hash[dummyHash] for longValueOne : " + dummyHash(longValueOne)); |
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
<html> | |
<body> | |
<h1>OUTPUT;</h1> | |
<p id="demo"></p> | |
<script> | |
"use strict"; | |
var maxTime = 1000; | |
var outbox = document.getElementById("demo"); | |