Skip to content
Snippets Groups Projects
Verified Commit b7c6b693 authored by orestis.malaspin's avatar orestis.malaspin
Browse files

added stuff

parents
No related branches found
No related tags found
No related merge requests found
[submodule "css"]
path = css
url = https://github.com/edwardtufte/tufte-css.git
Makefile 0 → 100644
OPTIONS = --filter=pandoc-crossref
PDFOPTIONS = --highlight-style kate
PDFOPTIONS += --pdf-engine pdflatex
PDFOPTIONS += --number-sections
HTMLOPTIONS += -t html5
HTMLOPTIONS += -c css/tufte-css/tufte.css
HTMLOPTIONS += --self-contained
MD=$(wildcard *.md)
HTML=$(MD:%.md=%.html)
PDF=$(MD:%.md=%.pdf)
all: $(HTML) $(PDF)
%.pdf: %.md Makefile
pandoc -s $(OPTIONS) $(PDFOPTIONS) -o $@ $<
%.html: %.md Makefile
pandoc -s $(OPTIONS) $(HTMLOPTIONS) -o $@ $<
deploy: all
mkdir -p prog_seq_c_tp/tris_multiples
cp tris_multiples.html prog_seq_c_tp/tris_multiples/index.html
cp tris_multiples.pdf prog_seq_c_tp/tris_multiples/tris_multiples.pdf
clean:
rm -rf *.html *.pdf prog_seq_c_tp
Subproject commit 957e9c6dc3646ab1847ebe41fdb853e59ecf8579
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -4
AlignAfterOpenBracket: AlwaysBreak
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: true
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortLambdasOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: MultiLine
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: AfterColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: AfterColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
- Regex: '^<.*'
Priority: 2
SortPriority: 0
- Regex: '.*'
Priority: 3
SortPriority: 0
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: false
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentWidth: 4
IndentWrappedFunctionNames: true
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Right
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: ''
BasedOnStyle: google
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Auto
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 4
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
...
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
void print(int size, int tab[size]);
void random_tab(int size, int tab[size], int inf, int sup);
void selection_sort(int size, int tab[size]);
void radix_sort(int size, int tab[size]);
void merge_sort(int size, int tab[size]);
void quick_sort(int size, int tab[size], int first, int last);
bool is_sorted(int size, int tab[size]);
int main(int argc, char **argv) {
if (argc != 4) {
printf("usage: program <size> <seed> <sorting_algo_number>\n");
printf(" - size: number of numbers in the table\n");
printf(" - seed: seed for the random number\n");
printf(
" - sorting_algo_number: 1 radix-sort, 2 merge-sort, 3 selection-sort, 4 "
"quick-sort\n");
return EXIT_FAILURE;
}
// Add variables for input here: size, seed, sorting_algo_number.
srand(seed);
int res[size];
random_tab(size, res, -50, 50);
print(size, res);
printf("\n");
switch (sorting_algo_number) {
case 1:
radix_sort(size, res);
break;
case 2:
merge_sort(size, res);
break;
case 3:
selection_sort(size, res);
break;
case 4:
quick_sort(size, res, 0, size);
break;
default:
printf("Choice non available\n");
break;
}
print(size, res);
printf("\n");
return EXIT_SUCCESS;
}
void print(int size, int tab[size]) {
for (int i = 0; i < size; i++) {
printf("%d ", tab[i]);
}
}
void random_tab(int size, int tab[size], int inf, int sup) {
for (int i = 0; i < size; i++) {
tab[i] = inf + rand() % (sup - inf + 1);
}
}
void selection_sort(int size, int tab[size]) {
// à compléter
}
void merge_sort(int size, int tab[size]) {
// à compléter
}
// Tri rapide récursif
void quick_sort(int size, int array[size], int first, int last) {
// à compléter
}
// Déterminer si le tableau est trié ou non
bool is_sorted(int size, int tab[size]) {
// à compléter
}
---
author:
- Tris divers et performances
title: Cours de programmation séquentielle
autoSectionLabels: false
autoEqnLabels: true
eqnPrefix:
- "éq."
- "éqs."
chapters: true
numberSections: false
chaptersDepth: 1
sectionsDepth: 3
lang: fr
documentclass: article
papersize: A4
cref: false
urlcolor: blue
toc: false
---
# Buts
- Utilisation de tableaux unidimensionnels.
- Implémentations d'algorithmes de tris.
- Utilisation de `make`.
# Énoncé
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment