Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
40cd963202 | |||
d2ffcf8c9a | |||
a66a649b48 | |||
|
df9e43e534 | ||
|
babed7eb09 | ||
|
990b77ed18 | ||
|
025b0e2166 | ||
|
c4e193e45f | ||
|
3b2f4c84d7 | ||
|
58acfde2b4 | ||
dabb46879d | |||
0424fbcca6 | |||
|
dfe4fd3729 | ||
|
2649bc9a54 | ||
|
d35439f7d3 | ||
5a7048a0a4 | |||
d5ca967c0c | |||
|
b0f02b0d5d | ||
|
4de4dcf2c2 | ||
|
4fd7542f03 |
13
.gitignore
vendored
@ -1,3 +1,16 @@
|
|||||||
__pycache__/
|
__pycache__/
|
||||||
*.tar
|
*.tar
|
||||||
*.class
|
*.class
|
||||||
|
*.toc
|
||||||
|
*.synctex.gz
|
||||||
|
*.snm
|
||||||
|
*.out
|
||||||
|
*.aux
|
||||||
|
*.fbd_latexmk
|
||||||
|
*.fls
|
||||||
|
*.log
|
||||||
|
*.nav
|
||||||
|
*.fdb_latexmk
|
||||||
|
a.out
|
||||||
|
*.o
|
||||||
|
ex[0-9]
|
||||||
|
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "bac2/latex/beamer-umons"]
|
||||||
|
path = bac2/latex/beamer-umons
|
||||||
|
url = git@github.com:Chris00/beamer-umons
|
Before Width: | Height: | Size: 256 KiB After Width: | Height: | Size: 256 KiB |
Before Width: | Height: | Size: 321 KiB After Width: | Height: | Size: 321 KiB |
Before Width: | Height: | Size: 261 KiB After Width: | Height: | Size: 261 KiB |
Before Width: | Height: | Size: 790 KiB After Width: | Height: | Size: 790 KiB |
Before Width: | Height: | Size: 727 KiB After Width: | Height: | Size: 727 KiB |
Before Width: | Height: | Size: 161 KiB After Width: | Height: | Size: 161 KiB |
Before Width: | Height: | Size: 186 KiB After Width: | Height: | Size: 186 KiB |
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 172 KiB |
9
bac1/q2/algo/.idea/algo.iml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="JAVA_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
7
bac1/q2/algo/.idea/misc.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MarkdownSettingsMigration">
|
||||||
|
<option name="stateVersion" value="1" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="20" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
8
bac1/q2/algo/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/algo.iml" filepath="$PROJECT_DIR$/.idea/algo.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
6
bac1/q2/algo/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -1,32 +1,29 @@
|
|||||||
public class hashmap implements Map{
|
public class hashmap implements Map{
|
||||||
|
|
||||||
public static final TAB_SIZE = 1024;
|
public static final TAB_SIZE = 1024;
|
||||||
Object[] values = new Object[TAB_SIZE];
|
LinkedList[] values = new Object[TAB_SIZE];
|
||||||
class tuple{ public Object key, values;
|
class HashEntry{ public Object key, values;
|
||||||
public tuple(Object key, Object value){
|
public HashEntry(Object key, Object value){
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public hashmap() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void put(Object key, Object value){
|
public void put(Object key, Object value){
|
||||||
int pos = key.hashCode() % values.lenght();
|
int pos = key.hashCode() % values.lenght();
|
||||||
if (values[pos] == null){
|
if (values[pos] == null){
|
||||||
values[pos] = value;
|
values[pos] = value;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(value[pos] instanceof ArrayList<tuple> t){
|
if(value[pos] instanceof ArrayList<HashEntry> t){
|
||||||
t.add(new tuple(key, value));
|
t.add(new HashEntry(key, value));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Object temp = values[pos];
|
Object temp = values[pos];
|
||||||
values[pos] = new ArrayList<tuple>;
|
values[pos] = new ArrayList<HashEntry>;
|
||||||
value[pos].add(temp);
|
value[pos].add(temp);
|
||||||
value[pos].add(new tuple(key, value));
|
value[pos].add(new HashEntry(key, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object get(Object key){
|
public Object get(Object key){
|
||||||
@ -34,7 +31,7 @@ public class hashmap implements Map{
|
|||||||
if(values[pos].equals(key)){
|
if(values[pos].equals(key)){
|
||||||
return values[pos].value;
|
return values[pos].value;
|
||||||
}
|
}
|
||||||
if(values[pos] instanceof ArrayList<tuple> t){
|
if(values[pos] instanceof ArrayList<HashEntry> t){
|
||||||
for (v : t) {
|
for (v : t) {
|
||||||
if (v.key.equals(key)){
|
if (v.key.equals(key)){
|
||||||
return v.value
|
return v.value
|
||||||
@ -44,5 +41,9 @@ public class hashmap implements Map{
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("test");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
9
bac1/q2/algo/hashmap/.idea/misc.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="MarkdownSettingsMigration">
|
||||||
|
<option name="stateVersion" value="1" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="20" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
8
bac1/q2/algo/hashmap/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/hashmap.iml" filepath="$PROJECT_DIR$/hashmap.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
36
bac1/q2/algo/hashmap/HashMap.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
public class HashMap {
|
||||||
|
LinkedList<HashEntry>[] tab;
|
||||||
|
Iterator iter;
|
||||||
|
|
||||||
|
class HashEntry{
|
||||||
|
public Object key, value;
|
||||||
|
}
|
||||||
|
|
||||||
|
class MyHashMapIterator implements Iterator{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
public MyHashMapIterator(){
|
||||||
|
while(i<tab.length){
|
||||||
|
if(tab[i] == null)
|
||||||
|
continue;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasNext() {
|
||||||
|
if(i >= tab.length)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object next() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|