code
stringlengths
3
1.18M
language
stringclasses
1 value
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/** Automatically generated file. DO NOT MODIFY */ package com.google.android.gcm; public final class BuildConfig { public final static boolean DEBUG = true; }
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
/* * Copyright 2012 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in w...
Java
package binarytree; class Main { public static void main(String[] args) { binarytree<Integer> b= new binarytree<Integer>(); b.add(5); b.add(3); b.add(2); b.add(4); b.add(7); b.add(6); b.getLeaves(); System.out.println("/n"); b.show(); } }
Java
package knight; import java.util.ArrayList; public class program2knight { static int N = 8; static int[][] board = new int[N][N]; static int[][] boardMove = new int[N][N]; public static void main(String[] args) { int c=0; int x=0; int y=0; boardMove[0][0]=c; board[0][0]=99; while(...
Java
package Fibonachi; public class program3 { public static void main(String[] args) { int n0 = 1, n1 = 1, n2; System.out.print(n0+" "+n1+" "); for(int i = 0; i < 18; i++){ n2=n0+n1; System.out.print(n2+" "); n0=n1; n1=n2; } ...
Java
package factorial; import java.util.Scanner; class Factorial { public static void main(String args[]) { int n, c, fact = 1; System.out.println("Enter an integer to calculate it's factorial"); Scanner in = new Scanner(System.in); n = in.nextInt(); if ( n < 0 ) ...
Java
package multiplucation; public class multiplication { static long x = 1234567890; static long y = 2121212121; static int counter1=0; static int counter2=0; static long[] mar1 = new long[100]; static long[][] mar2 = new long[100][100]; public static void multi(long x, long y) { int count=0; i...
Java
package slojenie; public class slojenie { public static int[] mar1; public static int[] mar2; public static int[] mar3; public static int shirina=5; public static int n=0; public static void create() { for(int i=1;i<shirina;i++) { mar1[i]=(int) (Math.random() * 9); } for(int i=0;i<shiri...
Java
import java.util.Random; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Random; public class main { public static void main(String[] args) { bubble_sort q = new bubble_sort(); bubble_sort w = new bubble_sort(); long time_start = 0; ...
Java
public class bubble_sort { public void Bubble_sort(int array[], int n) { for (int i = 0; i < n; i++) for (int j = n - 1; j > 0; j--) if (array[j - 1] > array[j]) { int tmp = array[j - 1]; array[j - 1] = array[j]; array[j] = tmp; } } public void my_Bubble_sort(int array[], int n) ...
Java
package bin_search; public class search { public int bin_search (int array[], int n, int x) { int first = 0; int last = n; int mid = (last - first) / 2; if (last == 0) { return 0; } else if (array[0] > x) { return 0; } else if (array[n-1] < x) { return 0; } whi...
Java
package bin_search; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Random; public class main { public static void main(String[] args) { search w = new search(); long time_start = 0; int max = 15; int x =7; int[] array = new in...
Java
public class fib { public static int fibonachi(int n) { if (n < 2) return 1; main.oper +=1; return fibonachi(n-1) + fibonachi(n-2); } public static int fib_cycle(int n) { int i = 2; int fib_sum = 0; int fib1 = 1; int fib2 = 1; while (i < n) { fib_sum = fib2 + fib1; ...
Java
public class nod { public long evklid_func (long a, long b) { while (b !=0) { long tmp = a % b; a = b; b = tmp; } return a; } public long my_func (long a, long b) { long c = 1; long nod = 0; if (a < b) c = a; else c = b; for (int i = 1; i<=c; i++) ...
Java
package factorial; public class fact { public static long fact(long n) { main.oper +=1; if (n==1) return 1; return (n*fact(n-1)); } }
Java
package merge_sort; public class quick { void Quick_sort (int[] array, int start, int end) { int pivot; if ( start >= end ) { return; } int marker = start; for ( int i = start; i <= end; i++ ) { if ( array[i] <= array[end] ) { int t...
Java
package merge_sort; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Random; public class main { public static void main(String[] args) { quick q = new quick(); long time_start = 0; int max = 500000; System.out.printf("Merge\n"); f...
Java
package merge_sort; public class merge { static int[] Merge_Sort(int[] massive) { if (massive.length <= 1) return massive; int mid_point = massive.length / 2; return Merge(Merge_Sort(java.util.Arrays.copyOfRange(massive, 0, mid_point-1)), Merge_Sort(java.util.Arrays.cop...
Java
package horse; public class horse { int level; int stor; int count = 0; int horse(int w, int h, int[][] mass, int level) { //проверка ходов mass[w][h] = level; int flag = 1; if (level == stor*stor ) {count = count+1; printArr(mass, stor, stor);} if((0 <= h+2) && (h+2 < stor) && (0 <= w+1)...
Java
package horse; public class main { public static void main(String[] args) { horse horse = new horse(); int imax = 5; int jmax = 5; int [][] array = new int[imax][jmax]; horse.stor=5; for (int i = 0; i < horse.stor; i++) { for(int j = 0; j < horse.stor; j++) { horse.horse(i, j, ...
Java
package algorithms; import java.io.File; public class Tree { }
Java
package algorithms; public class Tree { public Element head = null; public Element min(){ Element current = head; while(current.left!=null){ current = current.left; } return current; } public Element max(){ Element current = head; while(current.right!=null){ current = current....
Java
package algorithms; public class Element { public Element right; public Element left; public Element parent; public int key; public char value; Element(int Key, char Value){ value = Value; key = Key; } }
Java
package algorithms; public class Element { public Element next; public int ch; public Element(int ch){ this.ch = ch; } }
Java
package algorithms; public class Element { public Element next; public String key; public String value; public Element(String key, String value){ this.key = key; this.value = value; } }
Java
package algorithms; public class Map { public Element head = null; public void Key_list(){ if(head == null){ System.out.println("Error: Map is empty!"); }else{ Element cur = head; System.out.print("Key list: "); while(cur.next!=null){ System.out.print(cur.key+" "); cur = cur.ne...
Java
package algorithms; public class Element { public Element next; public int ch; public Element(int ch){ this.ch = ch; } }
Java
package algorithms; public class TestCalendar { public static void main(String[] args) { Calendar c = new Calendar(); System.out.println(c.GetDay(new Day(31,4,2008))); } }
Java
package algorithms; public class Day { public int Number; public int Mounth; public int Year; public Day(int Number, int Mounth, int Year){ this.Number = Number; this.Mounth = Mounth; this.Year = Year; } }
Java
package algorithms; public class Element { public int key; public String value; Element(int Key,String Value){ key=Key; value=Value; } }
Java
package algorithms; public class Peak { public String [] next; public String c; public Peak(String c){ this.c = c; } }
Java
package algorithms; public class TestGraph { public static void main(String[] args) { Graph graph = new Graph(); String [] Peaks1 = {"B","G",null}; graph.Add_Peak(new Peak("A"),Peaks1); String [] Peaks2 = {"C","D", null}; graph.Add_Peak(new Peak("B"),Peaks2); String [] Peaks3 = {"E", null};...
Java
package algorithms; public class Element { public Element next; public String key; public Peak value; public Element(Peak value){ this.key = value.c; this.value = value; } }
Java
package algorithms; public class Element { public Element next; public int ch; public Element(int ch){ this.ch = ch; } }
Java
package algorithms; public class Stack { public Element head = null; public void PUSH(Element elem){ if(head == null){ head = elem; return; } if(head != null){ elem.next = head; head = elem; return; } } public Element POP(){ Element cur = head; head = head.next; ...
Java
package algorithms; public class Element { public Element next; public Element previous; public int ch; public Element(int ch){ this.ch = ch; } public Element(){ this.next=this; this.previous=this; } }
Java
import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class bisearch { @SuppressWarnings("resource") public static void main(String[] args) { int num=10; ArrayList<Integer> list = new ArrayList<Integer>(num); for(int i=0;i<num;i++){ list.add(i); } ...
Java
package fgd; public class SpisokTest { public static void main(String[] args) { Spisok s= new Spisok(); Spisok sp= new Spisok(); int []mas = new int[10]; for( int i=0; i<mas.length;i++) { mas[i] = (int)Math.round(Math.random()*(-10)); s.add(new Element(mas[i])); s.add_end(new E...
Java
package fgd; public class Spisok { Element head = null; public void add(Element elem){ if(head == null) { head = elem; } else{ Element current = head; while (current.next != null) { current = current.next; } current.next = elem; } } public void add_begin(E...
Java
package fgd; public class Element { public int i; public Element next = null; public Element(int i){ this.i=i; } }
Java
// programma hod konem! import java.util.Scanner; public class knight { static int lenght = 5; static int arr[][]; public static void main(String[] args) { Scanner cin = new Scanner(System.in); System.out.print("Input the size of the board: "); lenght = cin.nextInt(); arr = new int[lenght][leng...
Java
public class list { public element head = new element(); public void add_end(element elem){ if(head.next == head){ head.next=elem; head.prev=elem; elem.next=head; elem.prev=head; }else{ element cur = head; while(cur.next!=head){ cur = cur.next; } cur....
Java
public class element { public element next; public element prev; public int i; public element(int i){ this.i = i; } public element(){ this.next=this; this.prev=this; } }
Java
public class binarytree { public class Element { int num; Element left; Element right; public Element parent; public Element(int num, Element parent) { this.num = num; this.left = null; this.right = null; this.parent = parent; } } Element root; int lenght; pub...
Java
public class multiplication { static long x = 1234567890; static long y = 2123456789; static int counter1=0; static int counter2=0; static long[] arr1 = new long[100]; static long[][] arr2 = new long[100][100]; public static void multi(long x, long y) { int count=0; int c1=0,c2=0; while(y!=0...
Java
package stolbik; public class slojenie { public static int[] arr1; public static int[] arr2; public static int[] arr3; public static int length=5; public static int n=0; public static void create() { for(int i=1;i<length;i++) { arr1[i]=(int) (Math.random() * 9); } for(int i=0;i<lengt...
Java
import java.util.Random; public class numberone { public static int num = 5; public static int crutch = 0; public static int howmuch(int x,int y,int arr [][]) { int count = 0; if(x+1<num && y+2<num && arr[y+2][x+1] == 0){count++;} if(x+2<num && y+1<num && arr[y+1][x+2] == 0){count++;} if(y-2>...
Java
public class algs03 { public static int Mult(int max, int min, int t,int mult){ if(t>=min) { return mult; } else { mult = mult + max; return Mult(max,min,t+1,mult); } // return mult; } public static void main(String[] args) { int a = 2222; int b = 11; int mult = 0;...
Java
public class algs02 { public static long searchN(long x){ long N = 1; while(N < x) N = N * 10; if(N > 1) N = N / 10; return N; } public static long searchT(long x){ long T = 0; for(int N = 1; N < x; N=N*10){ T++; } return T; } public static void main(String[] args) ...
Java
public class algs04 { public static int searchT(int x){ int T = 0; for(int N = 1; N < x; N=N*10){ T++; } return T; } public static int xtn(int x,int n){ int a = x; for(int iter = 1; iter < n; iter++) a = a * x; return a; } public static void main(String[] args) { int a = 2222...
Java
public class algs01 { public static int searchN(int x){ int N = 10; while(N < x) N = N * 10; N = N / 10; return N; } public static int searchT(int x){ int T = 0; for(int N = 1; N < x; N=N*10){ T++; } return T; } public static void main(String[] args) { int x = 123456789...
Java
public class Fib { static int count = 0; public static int fibo_native(int N){ if(N < 2) return N; count++; //System.out.print(" " + N); return fibo_native(N - 2) + fibo_native(N - 1); } public static void main(String[] args) { long start = System.nanoTime(); System.out.println(fibo_na...
Java
import java.util.ArrayList; import java.util.Collections; public class bublesort { public static int num = 10; public static ArrayList<Integer> list = new ArrayList<Integer> (num); public static ArrayList<Integer> justbubsor(){ int t = num - 1; for(int j = 0;j < t; j++){ for(int i = 0;i < t; i+...
Java
public class NOD { public static int del(int n,int m){ int count; int exit; if(n < m){ count = m % n; if(count != 0) return del(n,m % n); else exit = n; } else{ count = n % m; if(count != 0) return del(n % m,m); else exit = m; } return exit; ...
Java
public class factorial { public static void main(String[] args){ int x = 12; int fac = 1; for(int i = 1;i <= 12;i++){ fac = fac * i; System.out.println(fac); } } }
Java
import java.util.Random; public class numberone { public static int num = 5; public static int crutch = 0; public static int howmuch(int x,int y,int arr [][]) { int count = 0; if(x+1<num && y+2<num && arr[y+2][x+1] == 0){count++;} if(x+2<num && y+1<num && arr[y+1][x+2] == 0){count++;} if(y-2>...
Java
package Algorithms; import java.util.ArrayList; public class BS { public static int num = 10; public static ArrayList<Integer> list = new ArrayList<Integer> (num); public static int bs(int x){ int l = list.get(0); int i = num - 1; int r = list.get(i); while(x != list.get(i)){ i = (l+r)/...
Java
public class test { public static void main(String[] args) { map director = new map(); mkv test = new mkv(); director.create(test, 6); director.add(test,"Name","Aleks"); director.add(test,"Sirname","Stown"); director.add(test,"Age","37"); director.printmap(test); director.justsearc(tes...
Java
import java.util.ArrayList; public class mkv { public ArrayList<String> key = new ArrayList<String>(); public ArrayList<String> value = new ArrayList<String>(); }
Java
public class map { public void create(mkv MapArr,int size) { for(int i = 0;i < size;i++) { MapArr.key.add(null); MapArr.value.add(null); } } public void add(mkv MapArr,String Key,String Value) { int check = 0; int size = MapArr.key.size(); for(int i = 0;i < size;i++) { i...
Java
import java.util.ArrayList; import java.util.Collections; public class Merge { public static int num = 8; public static ArrayList<Integer> list = new ArrayList<Integer> (num); public static ArrayList<Integer> mergesort(ArrayList<Integer> arr) { int x = arr.size(); ArrayList<Integer> left = new Ar...
Java
public class spisok { public element head = null; public void delbeg(element elem) { if(head == null) { head = elem; } else { head=null; elem=null; } } public void delend(element elem){ if(head == null) { head = elem; } else { ...
Java
public class element { public element next; public int i; public element(int i) { this.i = i; } }
Java
public class AlgEv { }
Java
public class lists { Element head = null; public void addend (Element elem) { if (head == null) { head = elem; } else { Element cur = head; while (cur.next != null) { cur = cur.next; } cur.next = elem; } } public void addbeg (Element elem) { elem....
Java
public class Element { public Element next = null; public int i; Element (int i) { this.i=i; } }
Java
import java.util.Scanner; public class DateOfBirth { public static void Data(int day, int month, int year) { int wd=0; if(month <= 2) { year=year-1; day=day+3; } wd = (1 + (day + year + year/4 - year/100 + year/400 + (31*month + 10)/12))%7; switch (wd) { case 0: {Syst...
Java
class Element { public Element next = null; public int i; Element (int i) { this.i=i; } } public class StackOnLists { Element head = null; public String toString() { StringBuffer sb = new StringBuffer(); sb.append("{ "); Element current = head; while (current != null) { s...
Java
package pack; public class fibo { public static void main(String[] args) { long start; start = System.nanoTime(); System.out.println(fibo(7)); System.out.println("Time of running: "+(System.nanoTime()-start)+" nanosec"); start = System.nanoTime(); System.out.println(fibo_re...
Java
package pack; public class BinaryTree { public class Node { int num; Node left; Node right; Node iam; Node parent; public Node(int num, Node parent) { this.num = num; this.left = null; this.right = null; this.iam = this; this.parent = parent; } } Node root;...
Java
package pack; import java.util.Scanner; public class searchs { public static void randomArr(int arr[]) { for(int k = 0; k < arr.length; k++) arr[k] = (int)(Math.random()*arr.length); } public static void printArr(int arr[]) { for(int k = 0; k < arr.length; k++) System.out.print(arr[k] + ...
Java
package pack; public class nod { public static void main(String[] args) { int a = 300000; int b = 1701; long start; start = System.nanoTime(); System.out.println("Nod: " + nod(a, b)); System.out.println("Time of running: "+(System.nanoTime()-start)+" nanosec"); start = System....
Java
package pack; public class TreeHeap { int arr[]; public TreeHeap() { // int mass[] = {0,2,3,2,4,5,7,9,6,8,9,11,8,9}; arr = new int[11]; } private int getLeft(int i) { if(0 < 2*i && 2*i < arr.length) return arr[2*i]; return 0; } private int getRight(int i) { if(0 < 2*i+1...
Java
package pack; public class TwoThreeFourTree { public class Node { int type; int nodes; int num1; int num2; int num3; Node node1; Node node2; Node node3; Node node4; Node parent; public Node(int num) { this.type = 1; this.nodes = 0; this.num1 = num; this.pare...
Java
package pack; class ElementStack { int num; ElementStack next; public ElementStack(int num) { this.num = num; next = null; } } public class Stack { ElementStack head = null; int lenght = 0; public Stack() { this.head = null; lenght = 0; } private String toStr() { St...
Java
package pack; class ElementCycled { int num; ElementCycled next; ElementCycled prev; public ElementCycled(int num) { this.num = num; next = this; prev = this; } } public class CycledList { ElementCycled sentry = null; int lenght = 0; public CycledList() { sentry = new Element...
Java
package pack; import java.awt.List; import java.io.File; import java.util.Vector; class Trunk { String path; int iByte; Vector<Trunk> sons; public Trunk(String path) { this.path = path; this.iByte = 0; sons = new Vector<Trunk>(); } } public class TreeForDirectory { Trunk root; ...
Java