This file contains hidden or 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 V put(K key, V value) { | |
return putVal(hash(key), key, value, false, true); | |
} | |
/** | |
* Implements Map.put and related methods | |
* | |
* @param hash hash for key | |
* @param key the key | |
* @param value the value to put |
This file contains hidden or 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 V put(K key, V value) { | |
int Hash = hash(key.hashCode()); | |
//use the Hash as a mask | |
int ind = (Hash & (n - 1)); | |
//put if the ind is bigger then the internal table resize() | |
table[ind] = new Node(hash, key, value); | |
} |
This file contains hidden or 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 V get(Object key) { | |
Node<K,V> e; | |
return (e = getNode(hash(key), key)) == null ? null : e.value; | |
} | |
/** | |
* Implements Map.get and related methods | |
* | |
* @param hash hash for key | |
* @param key the key |
This file contains hidden or 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 V get(Object key){ | |
int Hash = hash(key.hashcode()); | |
int ind = (Hash & (n - 1)); | |
return table[ind]; // the value at the calculated index | |
} |
This file contains hidden or 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 <string.h> | |
int t, n; | |
int isInt(char a){return a >= '0' && a <= '9';} | |
typedef struct card{ | |
int n, type; | |
}card; | |
card Card(char a[2]) { | |
card r; |
This file contains hidden or 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 <string.h> | |
#define clr(a,b) memset((a), (b), sizeof((a))) | |
/** | |
* | |
* @Author Mehdi Maick | |
*/ | |
int n, t, k; |
This file contains hidden or 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
t = int(input()) | |
for i in range(t): | |
n = int(input()) | |
votes = [0]*(n + 1) | |
mi = 0 | |
for j in range(n): | |
votes[j] = int(input()) | |
if votes[j] > votes[mi]: | |
mi = j | |
s = sum(votes) |
This file contains hidden or 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 <string.h> | |
#include <stdlib.h> | |
int main(int argc , char* argv[]) { | |
int t, tc = 1, a, b, ans; | |
char op; | |
char name[20], res[20]; | |
scanf("%d",&t); |
This file contains hidden or 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.io.IOException; | |
import java.nio.file.*; | |
import java.util.concurrent.TimeUnit; | |
/** | |
* Created by mac on 01/01/2017. | |
*/ | |
public class WatchServiceDemo { |
This file contains hidden or 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 <cmath> | |
#include <cstdio> | |
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
#include <map> | |
using namespace std; | |
long long p(long long n){ | |
return n * (3*n - 1)/2; |