Commit ee897b9a authored by Moïse Destin's avatar Moïse Destin
Browse files

Exercice 1

parent 51d2b390
Pipeline #4478 failed with stage
in 6 seconds
File added
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_16" project-jdk-name="17" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/sda.iml" filepath="$PROJECT_DIR$/sda.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
</set>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="298fa7eb-9511-4983-9e33-1e1f5e3f9ebe" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/Java/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/Java/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/launch_analysis.sh" beforeDir="false" afterPath="$PROJECT_DIR$/launch_analysis.sh" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1yuK8SbGqfHL2hMeRyIBJZ5zLOS" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/Java" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
</component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/Java" />
</key>
</component>
<component name="RunManager">
<configuration name="TasUtilisateur" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="TasUtilisateur" />
<module name="sda" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.TasUtilisateur" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="298fa7eb-9511-4983-9e33-1e1f5e3f9ebe" name="Changes" comment="" />
<created>1633095875249</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1633095875249</updated>
<workItem from="1633095878751" duration="5943000" />
<workItem from="1633462987730" duration="235000" />
<workItem from="1633610273237" duration="25194000" />
<workItem from="1634223754946" duration="26971000" />
<workItem from="1635251919885" duration="31000" />
<workItem from="1635251962630" duration="689000" />
<workItem from="1635365695090" duration="598000" />
<workItem from="1635770461992" duration="14725000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
</project>
\ No newline at end of file
Destin Moïse 12108416
Stacy Rose 11702435
\ No newline at end of file
......@@ -30,6 +30,8 @@ public class Main {
copy_analysis.append( (memory_allocation == true)? i: 1);
// Enregistrement de l'espace mémoire non-utilisé.
memory_analysis.append( a.capacity() - a.size() );
}
// Affichage de quelques statistiques sur l'expérience.
......
public class Tas {
private static final int d= 2;
private int[] monTas;
private int capaciteTas; // controle reaching capacity d'insertion
private int nombreEchange = 0;
/**
* initialiser tas
*/
public Tas(int taille){
capaciteTas = 0;
monTas = new int[ taille+1]; //+0
}
/**
* le tas est-il plein
*/
public boolean isTasPlein(){
return capaciteTas == monTas.length;
}
private int parent(int i){
return (i-1)/d;
}
/**
* ajoute un nouverau element dans le tas
* dependemment du chiffre on peut remonter jusqu au root
*/
public void insererElement(int x){
if(isTasPlein())
throw new UnsupportedOperationException("le tas est plein, il n'y a plus de place pour inserer de nouveau element");
monTas[capaciteTas++] = x; // ajoute au dernier space vide
entasser(capaciteTas -1);
}
/**
* garder la propriete
*
*/
private void entasser(int i) {
int temp = monTas[i];
while(i>0 && temp > monTas[parent(i)]){
monTas[i] = monTas[parent(i)];
i = parent(i);
this.nombreEchange++;
}
monTas[i] = temp;
}
/**
* afficher tas
*
*/
public void afficherTas()
{
System.out.print("Tas = ");
for (int i = 0; i < capaciteTas; i++)
System.out.print(monTas[i] +" ");
System.out.println();
}
public int getNombreEchange() {
return nombreEchange;
}
}
import java.util.Scanner;
public class TasUtilisateur {
public static void main(String[] args) {
// notre tas
Tas tas;
int taille_du_tableau;
Scanner entreUtilisateur = new Scanner(System.in);
System.out.print("Entrer la taille du tableau: ");
taille_du_tableau = entreUtilisateur.nextInt();
tas = new Tas(taille_du_tableau);
demandeInsertionElement();
while(entreUtilisateur.hasNext())
{
tas.insererElement(entreUtilisateur.nextInt());
tas.afficherTas();
System.out.println("\nNombre d'echange effectue: "+tas.getNombreEchange());
demandeInsertionElement();
}
}
private static void demandeInsertionElement() {
System.out.println("\nEntrer les clés du tableau(entier): ");
}
}
......@@ -2,33 +2,6 @@ RED='\033[0;31m'
NC='\033[0m' # No Color
# Compilation et exécution en C:
echo "${RED} Compilation du code source en C ${NC}"
cd C/
make
echo "${RED} Exécution des benchmarks en C ${NC}"
./arraylist_analysis
echo "${RED} Nettoyage ${NC}"
make clean
cd ..
# Compilation et exécution en C++:
echo "${RED} Compilation du code source en C++ ${NC}"
cd CPP/
make
echo "${RED} Exécution des benchmarks en C++ ${NC}"
./arraylist_analysis
echo "${RED} Nettoyage ${NC}"
make clean
cd ..
# Compilation et exécution en Java:
......@@ -38,31 +11,21 @@ cd Java
javac *
echo "${RED} Exécution des benchmarks en Java ${NC}"
java Main
java TasUtilisateur
echo "${RED} Nettoyage ${NC}"
rm *.class
cd ..
# Exécution en Python
echo "${RED} Compilation du code source en Python ${NC}"
cd Python
echo "${RED} Exécution des benchmarks en Python ${NC}"
python main.py
#
cd ..
# Observation des résultats
### Dans le répertoire plots, lisez le contenu du fichier plot_result
cd plots
more plot_result
### puis lancez ce script avec gnuplot
gnuplot plot_result
#cd plots
#more plot_result
#
#### puis lancez ce script avec gnuplot
#
#gnuplot plot_result
RED='\033[0;31m'
NC='\033[0m' # No Color
# Compilation et exécution en Java:
echo "${RED} Compilation du code source en Java ${NC}"
cd Java
javac *
echo "${RED} Exécution des benchmarks en Java ${NC}"
java TasUtilisateur
echo "${RED} Nettoyage ${NC}"
rm *.class
#
cd ..
<?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$">
<sourceFolder url="file://$MODULE_DIR$/Java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment