This commit is contained in:
Debucquoy committed 2023-09-20 15:18:20 +02:00
1 parent 00d0cdfaf3
commit 4fd7542f03
228 files changed
+351 -12

No files matched your search

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Before

Width:  |  Height:  |  Size: 256 KiB

After

Width:  |  Height:  |  Size: 256 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 321 KiB

After

Width:  |  Height:  |  Size: 321 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 261 KiB

After

Width:  |  Height:  |  Size: 261 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 790 KiB

After

Width:  |  Height:  |  Size: 790 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 727 KiB

After

Width:  |  Height:  |  Size: 727 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 161 KiB

After

Width:  |  Height:  |  Size: 161 KiB

File renamed without changes.

Before

Width:  |  Height:  |  Size: 186 KiB

After

Width:  |  Height:  |  Size: 186 KiB

File renamed without changes.
File renamed without changes.

Before

Width:  |  Height:  |  Size: 173 KiB

After

Width:  |  Height:  |  Size: 173 KiB

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+9
View 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
View 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
View 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
View 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>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -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");
}
}
File renamed without changes.
+9
View 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
View 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>
File renamed without changes.
+36
View 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) {
}
}
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="GENERAL_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
File renamed without changes.
Loaded 100 of 228 files, more files were not shown because too many files have changed in this diff. Show more