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 JSL = JSL || {}; | |
JSL.HashMap = function () { | |
"use strict"; | |
var keys = [], | |
values = []; | |
function indexOf(key) { | |
var i = 0; | |
if (keys.indexOf !== undefined) { | |
return keys.indexOf(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
bool isPalindrom(const int n) { | |
int temp = n, reversed = 0; | |
while (temp != 0) { | |
int rem = temp % 10; | |
reversed = reversed * 10 + rem; | |
temp /= 10; | |
} | |
return reversed == n; |
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
def collatz(x): | |
z = 0 | |
while x != 1: | |
if x % 2 == 0: | |
x /= 2 | |
else | |
x = x * 3 + 1 | |
z += 1 | |
return z |
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.ArrayList; | |
import java.util.List; | |
public class Node<T> { | |
private Node<T> parent; | |
private List<Node<T>> children; | |
private T data; | |
public Node(Node<T> parent) { | |
this(parent, null); |
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 [Paketpfad] | |
package io.mooxmirror.javakurs2; | |
// öffentliche Klasse 'HalloWelt' | |
public class HalloWelt { | |
// Einstiegsmethode 'main(String[] args)', muss vorhanden sein! | |
public static void main(String[] args) { | |
// Gebe Text 'Hallo Welt!' aus! | |
System.out.println("Hallo Welt!"); |
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
// A Stack structure implementation | |
// (c) 2015 mooxmirror | |
#include <stdlib.h> | |
#include <stdio.h> | |
#define STACK_TYPE int | |
#define STACK_TYPE_NULL 0 | |
typedef struct stack stack; |
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
/* | |
A Stack structure implementation | |
(c) 2015 mooxmirror | |
*/ | |
#include <stdlib.h> | |
#include <stdio.h> | |
#define STACK_TYPE int | |
#define STACK_TYPE_NULL NULL |
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
/* | |
A Stack structure implementation | |
(c) 2015 mooxmirror | |
*/ | |
#include "stack.h" | |
Stack * Stack_create() | |
{ | |
Stack * s = (Stack *) malloc(sizeof(Stack)); |
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 void sort(int[] a) { | |
int largestNumber = 0; | |
// find largest number | |
for (int n : a) | |
if (largestNumber < n) largestNumber = n; | |
// calculate needed iterations | |
final int maxIterations = (int) Math.log10(largestNumber) + 1; |
OlderNewer