Podcast
Questions and Answers
What is the ratio of the root-mean-square (rms) velocity of a hydrogen molecule to that of a helium atom at the same temperature?
What is the ratio of the root-mean-square (rms) velocity of a hydrogen molecule to that of a helium atom at the same temperature?
- $2:1$
- $1:2$
- $1:\sqrt{2}$
- $\sqrt{2}:1$ (correct)
In the following nuclear reaction, ${}{z}^{A}X \rightarrow {}{z-2}^{A-4}Y \rightarrow {}{z}^{A-4}Y \rightarrow {}{z-1}^{A-4}K$, what radioactive radiations are emitted in sequence?
In the following nuclear reaction, ${}{z}^{A}X \rightarrow {}{z-2}^{A-4}Y \rightarrow {}{z}^{A-4}Y \rightarrow {}{z-1}^{A-4}K$, what radioactive radiations are emitted in sequence?
- $\alpha, \beta, \gamma$
- $\gamma, \alpha, \beta$
- $\beta, \gamma, \alpha$
- $\alpha, \gamma, \beta$ (correct)
Two opposite corners of a square contain equal charges Q, and the other opposite corners contain charge q. What must be true if the net force on Q is zero?
Two opposite corners of a square contain equal charges Q, and the other opposite corners contain charge q. What must be true if the net force on Q is zero?
- $Q = 2\sqrt{2}q$
- $Q = -2\sqrt{2}q$ (correct)
- $Q = -2q$
- $Q = +2q$
If a gas has $f$ degrees of freedom, determine the ratio of specific heat at constant pressure ($C_p$) to specific heat at constant volume ($C_v$).
If a gas has $f$ degrees of freedom, determine the ratio of specific heat at constant pressure ($C_p$) to specific heat at constant volume ($C_v$).
One mole of an ideal diatomic gas is heated at a constant pressure of 1 atmosphere from 0C to 100C. What is the approximate change in internal energy of the gas?
One mole of an ideal diatomic gas is heated at a constant pressure of 1 atmosphere from 0C to 100C. What is the approximate change in internal energy of the gas?
A sound source of frequency $n$ is sounded with another source of frequency 200 $s^{-1}$, the number of beats produced per second is 5. If the second harmonic of the sound source gives 10 beats/sec when sounded with a source of frequency 420 $s^{-1}$, what is the value of n?
A sound source of frequency $n$ is sounded with another source of frequency 200 $s^{-1}$, the number of beats produced per second is 5. If the second harmonic of the sound source gives 10 beats/sec when sounded with a source of frequency 420 $s^{-1}$, what is the value of n?
Energy bands in solids are best described by which principle?
Energy bands in solids are best described by which principle?
A man approaches a plane mirror with a speed of 2 m/s. With what speed does he approach his image?
A man approaches a plane mirror with a speed of 2 m/s. With what speed does he approach his image?
A concave mirror has a focal length of 20 cm. An object is placed at a distance of 30 cm from the mirror. Where is the image formed?
A concave mirror has a focal length of 20 cm. An object is placed at a distance of 30 cm from the mirror. Where is the image formed?
The conduction in the semi-conductor due to breaking of the covalent bond occurs in?
The conduction in the semi-conductor due to breaking of the covalent bond occurs in?
What is the time period of a second's pendulum?
What is the time period of a second's pendulum?
The velocity of sound in gases does not depend upon which factor?
The velocity of sound in gases does not depend upon which factor?
When antimony is doped in pure germanium (or silicon), what type of resulting semiconductor will it be?
When antimony is doped in pure germanium (or silicon), what type of resulting semiconductor will it be?
A gas absorbs 150 J of heat and does work of 50 J of expansion. Determine the resulting change in internal energy of the gas.
A gas absorbs 150 J of heat and does work of 50 J of expansion. Determine the resulting change in internal energy of the gas.
What are the dimensions of the coefficient of viscosity ($\eta$)?
What are the dimensions of the coefficient of viscosity ($\eta$)?
Why does bending of tap water occur towards a charged rod?
Why does bending of tap water occur towards a charged rod?
A charge particle of charge $2\mu C$ experiences a force of 0.02 N. Determine the magnitude of the electric field experienced by a particle.
A charge particle of charge $2\mu C$ experiences a force of 0.02 N. Determine the magnitude of the electric field experienced by a particle.
Determine the equivalent capacitance of the given circuit across points A and B, where each capacitor has a capacitance of C.
Determine the equivalent capacitance of the given circuit across points A and B, where each capacitor has a capacitance of C.
Lenz's law is a consequence of the conservation of which physical quantity?
Lenz's law is a consequence of the conservation of which physical quantity?
The radius of the hydrogen atom in its ground state is $5.3 \times 10^{-11}$m. After a collision with an electron, it is found to have a radius of $21.2 \times 10^{-11}$m. Determine the final state's principal quantum number 'n' of the atom.
The radius of the hydrogen atom in its ground state is $5.3 \times 10^{-11}$m. After a collision with an electron, it is found to have a radius of $21.2 \times 10^{-11}$m. Determine the final state's principal quantum number 'n' of the atom.
Flashcards
Isothermal Condition
Isothermal Condition
The heat given by the surrounding is equal to work done.
Potential Energy Source for Inducing Fusion
Potential Energy Source for Inducing Fusion
An energy source that can induce nuclear fusion reactions.
Speed of Projectile
Speed of Projectile
The speed of a body projected from Earth's surface with a speed equal to 4 times the escape speed when at infinite separation from centre of the earth.
Carnot Engine Efficiency
Carnot Engine Efficiency
Signup and view all the flashcards
Doubling Frequency of R-C Circuit
Doubling Frequency of R-C Circuit
Signup and view all the flashcards
Motion with acceleration
Motion with acceleration
Signup and view all the flashcards
Phenolphthalein in Alkali
Phenolphthalein in Alkali
Signup and view all the flashcards
Hydrate Form of Sodium Carbonate
Hydrate Form of Sodium Carbonate
Signup and view all the flashcards
Rate Constant and Reactant Concentration
Rate Constant and Reactant Concentration
Signup and view all the flashcards
Flavoring Agent in Jam Industry
Flavoring Agent in Jam Industry
Signup and view all the flashcards
Molecules of Gas at STP
Molecules of Gas at STP
Signup and view all the flashcards
Sn2+ Reduction of K2Cr2O7
Sn2+ Reduction of K2Cr2O7
Signup and view all the flashcards
Weakest Halogen Acid
Weakest Halogen Acid
Signup and view all the flashcards
Bonds in Sodium Cyanide
Bonds in Sodium Cyanide
Signup and view all the flashcards
CaCO3 Decomposition
CaCO3 Decomposition
Signup and view all the flashcards
Definition of Alpha
Definition of Alpha
Signup and view all the flashcards
Size of Nucleus
Size of Nucleus
Signup and view all the flashcards
Photoelectric Effect Dependence
Photoelectric Effect Dependence
Signup and view all the flashcards
Leukemia affects
Leukemia affects
Signup and view all the flashcards
Breaking Covalent Bond
Breaking Covalent Bond
Signup and view all the flashcards
Study Notes
Chemical Kinetics
- Reaction rate is the change in concentration of reactants or products with respect to time.
- The formula for the rate of a reaction, $aA + bB \rightarrow cC + dD$, is: $Rate = -\frac{1}{a} \frac{d[A]}{dt} = -\frac{1}{b} \frac{d[B]}{dt} = \frac{1}{c} \frac{d[C]}{dt} = \frac{1}{d} \frac{d[D]}{dt}$.
- The rate is always positive and the stoichiometric coefficients normalize the rate for each reactant and product.
- Reactants have a negative sign as they are consumed, while products have a positive sign as they are produced.
Factors Affecting Reaction Rate
- Concentration: Increased concentration generally increases the reaction rate.
- Temperature: Higher temperatures usually speed up reactions by increasing molecular collision frequency and energy.
- Surface Area: Increasing surface area increases the reaction rate for reactions involving solids.
- Catalyst: Catalysts accelerate reactions by lowering the activation energy.
- Pressure: Increased pressure increases the rate of gaseous reactions by increasing concentration.
- Light: Certain reactions are initiated or accelerated by light.
Rate Law
- The rate law relates reaction rate to reactant concentrations, determined experimentally
- For a reaction $aA + bB \rightarrow cC + dD$, it is expressed $Rate = k[A]^m[B]^n$.
- $k$ stands for the rate constant; $m$ and $n$ represent reaction orders with respect to A and B.
- $m + n$ is the overall reaction order
Determining Reaction Order
- Method of Initial Rates: The initial rate of the reaction gets measured with varying starting reactant concentrations. Reaction order is determined by measuring how the rate fluctuates with concentration.
- Graphical Method: The concentration of a reactant gets plotted against time. A straight line plot will reveal the reaction order.
- Zero order: $[A]$ vs t is linear
- First order: $ln[A]$ vs t is linear
- Second order: $1/[A]$ vs t is linear
Common Rate Laws
- Zero-Order Reactions: Rate is independent of reactant concentration.
- $Rate = k$
- $[A]_t = -kt + [A]_0$
- $t_{1/2} = \frac{[A]_0}{2k}$
- First-Order Reactions: Rate is directly proportional to the concentration of one reactant.
- $Rate = k[A]$
- $ln[A]_t = -kt + ln[A]_0$
- $t_{1/2} = \frac{0.693}{k}$
- Second-Order Reactions: Rate is proportional to the square of one reactant's concentration or the product of two reactants' concentrations.
- $Rate = k[A]^2$
- $\frac{1}{[A]_t} = kt + \frac{1}{[A]_0}$
- $t_{1/2} = \frac{1}{k[A]_0}$
- $[A]_t$ is the concentration of $A$ at time $t$, $[A]0$ is the initial concentration, and $t{1/2}$ is the half-life.
Collision Theory
- Collision: Reactant molecules must collide for a reaction to occur.
- Energy: Colliding molecules must possess a minimum activation energy ($E_a$).
- Orientation: Molecules must collide with proper orientation.
Arrhenius Equation
- The Arrhenius equation relates the rate constant to temperature, activation energy, and a frequency factor: $k = Ae^{-\frac{E_a}{RT}}$
- $k$ is the rate constant, $A$ is the frequency factor, $E_a$ is the activation energy, $R$ is the gas constant ($8.314 J/(mol \cdot K)$), and $T$ is temperature in Kelvin.
Determining Activation Energy
- By plotting $ln(k)$ versus $\frac{1}{T}$, a straight line is obtained with a slope of $-\frac{E_a}{R}$
- The activation energy $E_a$ can be determined from this slope.
- $ln(k) = ln(A) - \frac{E_a}{RT}$ or $ln(k) = -\frac{E_a}{R}(\frac{1}{T}) + ln(A)$
Reaction Mechanisms
- A reaction mechanism is a step-by-step sequence of elementary reactions for an overall chemical change.
Elementary Steps
- Elementary steps are single-step reactions. Molecularity is the number of reactant molecules:
- Unimolecular: one molecule decomposes or rearranges.
- Bimolecular: two molecules collide and react.
- Termolecular: three molecules collide and react.
Rate-Determining Step
- The slowest step in a reaction mechanism, determining the overall reaction rate.
Intermediates
- Species produced in one step and consumed in a subsequent step, not in the overall balanced equation.
Validating a Reaction Mechanism
- Elementary steps must add up to the overall balanced equation.
- The mechanism must align with the experimentally determined rate law.
Example
- $2NO(g) + O_2(g) \rightarrow 2NO_2(g)$
- Proposed Mechanism:
- $NO(g) + NO(g) \rightleftharpoons N_2O_2(g)$ (fast, equilibrium)
- $N_2O_2(g) + O_2(g) \rightarrow 2NO_2(g)$ (slow, rate-determining)
- Overall Reaction: $2NO(g) + O_2(g) \rightarrow 2NO_2(g)$
- Since $N_2O_2$ is an intermediate $[N_2O_2] = K[NO]^2$ from $K = \frac{[N_2O_2]}{[NO]^2}$
- Rate Law is $Rate = k[N_2O_2][O_2]$ which simplifies to $Rate = kK[NO]^2[O_2] = k'[NO]^2[O_2]$
Algèbre linéaire
Definições
- Espace vectoriel: Conjunto $E$ com adição e multiplicação por escalar que satisfaz associatividade, comutatividade, elemento neutro, inverso, distributividade e elemento neutro para multiplicação escalar.
- Sous-espace vectoriel: Subconjunto $F$ de $E$ não vazio, fechado para adição e multiplicação por escalar.
- Combinação linéaire: Expressão $\lambda_1 v_1 + \lambda_2 v_2 +... + \lambda_n v_n$, onde os $v_i$ são vetores e os $\lambda_i$ são escalares.
Famílias de vetores
- Espaço engendrado ("Span"): Conjunto $Vect(v_1, v_2,..., v_n)$ de todas as combinações lineares de $v_1, v_2,..., v_n$.
- Família livre: Conjunto de vetores $(v_1, v_2,..., v_n)$ cuja única combinação linear nula é com todos os coeficientes nulos.
- Família geradora: Conjunto de vetores $(v_1, v_2,..., v_n)$ que pode expressar qualquer vetor do espaço como combinação linear.
- Base: Família que é simultaneamente livre e geradora.
- Dimension: Número de vetores em uma base.
Aplicações lineares
- Aplicação linear: Função $f: E \rightarrow F$ entre espaços vetoriais tal que $f(u+v) = f(u) + f(v)$ e $f(\lambda \cdot u) = \lambda \cdot f(u)$.
- Noyau (Kernel): Conjunto $Ker(f) = {u \in E | f(u) = 0_F}$ de vetores de $E$ que são mapeados para o vetor nulo de $F$.
- Image (Imagem): Conjunto $Im(f) = {v \in F | \exists u \in E, f(u) = v}$ de vetores de $F$ que são a imagem de pelo menos um vetor de $E$.
Théoème du rang (Teorema do posto)
- Relação entre dimensões: $dim(E) = dim(Ker(f)) + dim(Im(f))$.
Chapter 5: Distributed Coordination
-
Need for distributed coordination involves:
- Leader election
- Mutual exclusion
- Commitment
-
Impossibility results, even with crash failures arise from:
- FLP (Fischer, Lynch, Paterson)
- CAP (Brewer)
Agreement
-
Binary consensus: All processes each propose a bit
- Non-faulty processes must decide on a single bit
- All non-faulty processes must decide on the same bit
- If all processes propose the same bit, non-faulty processes must decide on that bit
-
k-agreement: All processes propose a value
- Non-faulty processes must decide on a single value
- All non-faulty processes must decide on the same value
- The value decided must be one of the proposed values
Failure Models
- Crash failure
- Byzantine failure (arbitrary or malicious) where:
- A faulty process can do anything
Impossibility of Agreement
- FLP Impossibility Result [FLP85] states that in an asynchronous system, consensus cannot be guaranteed within a bounded time if there's even a single crash failure.
- Sketch of Proof:
- Assume an algorithm A that solves binary consensus.
- A must have at least one critical state.
- A state from which, depending on the next message, either a 0 or 1 outcome is decided.
- Delay m results in system decides 1
- Deliver m, the system decides 0, which results in a Contradiction.
Paxos
-
It's a family of protocols for solving consensus in distributed systems, despite failures.
-
Based on the state machine approach
- If all processes propose the same sequence of commands, then all non-faulty processes will execute the same sequence of commands.
- Replicated state machines are used to achieve fault tolerance.
-
Basic Paxos assumptions:
- Single proposer
- Multiple acceptors
- Multiple learners
-
Illustrated using 3 Diagrams that portray it:
- First, the Client sends a command which the Proposer delivers to the Acceptors, and with mutual consensus they deliver the outcome to the Learners who notify the Client.
- Two-Phase Communication protocol used: Phase 1 with Preparing and Promising, and Phase 2 with Acepting and Learning.
- Each process has a state machine enabling fault tolerance through consistent replicated executions.
Algorithmes de tri
Tri par insertion
- Principe: Insérer un élément dans une partie déjà triée du tableau.
- Algorithme (Pseudocode):
fonction tri_insertion(tableau T)
n ← taille(T)
pour i de 1 à n - 1 faire
x ← T[i]
j ← i
tant que j > 0 et T[j - 1] > x faire
T[j] ← T[j - 1]
j ← j - 1
fin tant que
T[j] ← x
fin pour
fin fonction
- Complexité: $O(n^2)$
Tri fusion
- Principe: Diviser le tableau en deux, trier chaque partie, fusionner les deux parties triées.
- Algorithme (Pseudocode):
fonction tri_fusion(tableau T)
si taille(T) ≤ 1 alors
retourner T
sinon
m ← taille(T) / 2
T1 ← tri_fusion(T[0..m - 1])
T2 ← tri_fusion(T[m..taille(T) - 1])
retourner fusion(T1, T2)
fin si
fin fonction
fonction fusion(tableau T1, tableau T2)
n1 ← taille(T1)
n2 ← taille(T2)
T ← tableau de taille n1 + n2
i ← 0
j ← 0
k ← 0
tant que i < n1 et j < n2 faire
si T1[i] < T2[j] alors
T[k] ← T1[i]
i ← i + 1
sinon
T[k] ← T2[j]
j ← j + 1
fin si
k ← k + 1
fin tant que
tant que i < n1 faire
T[k] ← T1[i]
i ← i + 1
k ← k + 1
fin tant que
tant que j < n2 faire
T[k] ← T2[j]
j ← j + 1
k ← k + 1
fin tant que
retourner T
fin fonction
- Complexité: $O(n \log n)$
Tri rapide (Quick Sort)
- Principe: Choisir un pivot, partitionner le tableau, trier récursivement chaque partie.
- Algorithme (Pseudocode):
fonction tri_rapide(tableau T, entier debut, entier fin)
si debut < fin alors
pivot ← partitionner(T, debut, fin)
tri_rapide(T, debut, pivot - 1)
tri_rapide(T, pivot + 1, fin)
fin si
fin fonction
fonction partitionner(tableau T, entier debut, entier fin)
pivot ← T[fin]
i ← debut
pour j de debut à fin - 1 faire
si T[j] ≤ pivot alors
echanger(T[i], T[j])
i ← i + 1
fin si
fin pour
echanger(T[i], T[fin])
retourner i
fin fonction
fonction echanger(tableau T, entier i, entier j)
tmp ← T[i]
T[i] ← T[j]
T[j] ← tmp
fin fonction
- Complexité:
- Meilleur cas et cas moyen : $O(n \log n)$
- Pire cas : $O(n^2)$
Comparaison des algorithmes
Algorithme | Complexité (meilleur cas) | Complexité (cas moyen) | Complexité (pire cas) |
---|---|---|---|
Tri par insertion | $O(n)$ | $O(n^2)$ | $O(n^2)$ |
Tri fusion | $O(n \log n)$ | $O(n \log n)$ | $O(n \log n)$ |
Tri rapide | $O(n \log n)$ | $O(n \log n)$ | $O(n^2)$ |
Lógica proposicional
- Lógica proposicional is a system for representing and manipulating propositions, which can be true or false, but not both.
Elementos
- Variáveis proposicionais (Propositional variables): represent simple propositions ( p, q, r, etc.)
- Conectivos lógicos (Logical connectives): operators to create complex propositions.
- Negação ($\neg$): reverses truthness.
- Conjunção ($\land$): true if both true.
- Disjunção ($\lor$): true if at least one is true.
- Implicação ($\rightarrow$): only false if first true and second false.
- Bicondicional ($\leftrightarrow$): true if both proposition have the same truth value.
- Parênteses use to grouping to avoid ambiguities.
Tabelas verdade (Truth tables)
- The truth table definitions for values in proposition are shown below.
$p$ | $q$ | $p \land q$ | $p \lor q$ | $p \rightarrow q$ | $p \leftrightarrow q$ |
---|---|---|---|---|---|
V | V | V | V | V | V |
V | F | F | V | F | F |
F | V | F | V | V | F |
F | F | F | F | V | V |
Leis (Laws)
- Comutatividade
- $p \land q \equiv q \land p$
- $p \lor q \equiv q \lor p$
- Associatividade
- $(p \land q) \land r \equiv p \land (q \land r)$
- $(p \lor q) \lor r \equiv p \lor (q \lor r)$
- Distributividade
- $p \land (q \lor r) \equiv (p \land q) \lor (p \land r)$
- $p \lor (q \land r) \equiv (p \lor q) \land (p \lor r)$
- Idempotência
- $p \land p \equiv p$
- $p \lor p \equiv p$
- Negação
- $\neg (\neg p) \equiv p$
- $\neg (p \land q) \equiv \neg p \lor \neg q$ (De Morgan)
- $\neg (p \lor q) \equiv \neg p \land \neg q$ (De Morgan)
- Identidade
- $p \land V \equiv p$
- $p \lor F \equiv p$
- Dominância
- $p \land F \equiv F$
- $p \lor V \equiv V$
- Absorção
- $p \land (p \lor q) \equiv p$
- $p \lor (p \land q) \equiv p$
Inferência lógica (Logical inference)
- Process to define new proposition from existing propositions. Valid when the conclusion is true with true premises.
- Modus ponens: if $p \rightarrow q$ and $p$ are true, then $q$ is true.
- Modus tollens: if $p \rightarrow q$ is true and $q$ is false, then $p$ is false.
- Silogismo hipotético: if $p \rightarrow q$ and $q \rightarrow r$ are true, then $p \rightarrow r$ is true.
- Silogismo disjuntivo: if $p \lor q$ is true and $p$ is false, then $q$ is true.
Aplicações (Applications)
- Aplicações to verify program correctness, represent knowledge for AI, digital circuit design, math for theorem proving and analisysing arguments in philisophy.
Bernoulli's Principle
-
For nonviscous, incompressible fluid, speed increases with decreasing pressure or potential energy.
-
Bernoulli's equation mathematical expression is : $P_1 + \frac{1}{2} \rho v_1^2 + \rho g h_1 = P_2 + \frac{1}{2} \rho v_2^2 + \rho g h_2$
Variables:
Variable | Definition | Units |
---|---|---|
$P$ | Absolute pressure of the fluid | $N/m^2$ |
$\rho$ | Density of the fluid | $kg/m^3$ |
$v$ | Velocity of the fluid | $m/s$ |
$h$ | Height above an arbitrary point | $m$ |
$g$ | Acceleration due to gravity | $m/s^2$ |
- If height is constant, then speed increases with decreasing pressure.
- If speed is constant, then pressure increases with decreasing height.
Lecture 11: Bioreactors
Continuous Culture
- Conditions change in batch culture, In continuous culture fresh medium is added and old fermentation broth is removed contitnuously.
- In start-up of continuous culture, conditions and volume inside the bioreactor are constant
- Two types used:
- Chemostat
- Turbidostat
Chemostat
- Constant fow rate.
- Incoming medium's limiting nutrient concentration defines cell density.
- Dilution rate ($D$) determines organism growth rate via $D = F/V$, where $F$ is the flow rate and $V$ is the volume of the bioreactor.
- At steady state, $\mu = D$
- $\mu$ is the specific growth rate.
- Cells washout if $D$ is too high
- Cells grow slowly or die if $D$ is too low.
Chemostat
- Use Monod kinetics to calculate bioreactor's limiting nutrient concentration
- $ \mu = \mu_{max} \frac{S}{K_s + S} $ yields $ S = \frac{K_s D}{\mu_{max} - D} $
- $S$ is limiting nutrient concentration, $K_s$ is saturation constant, and $\mu_{max}$ is the maximum specific growth rate.
Turbidostat
- Turbidity (cell density) is kept constant adjusting rate.
- Sensor adjusts flow rate accordingly.
- Not Limiting nutrient
- Works at high cell density
- More complex and costly.
Bioreactor configurations:
- Batch
- Fed-Batch
- Continuous
- Chemostat
- Turbidostat
- Plug flow reactor
- Fluidized bed reactor
Plug Flow Reactor
- A long, cylindrical reactor
- No mixing occurs
- Similar to a continuous batch reactor
Fluidized Bed Reactor
- Cells are immobilized on solid particles that are suspended.
- High mass transfer rates.
- Suitable for product inhibited reactions
Bioreactor Design
- Design depends on application depending on organism, product, scale, and also the equipment cost.
Bioreactor Operation
- Bioreactor operation parameters to control are temperature, pH, dissolved oxygen, agitation rate, nutrient feed rate, and product removal rate.
Bioreactor Control
- Computer controls bioreactors by monitoring parameters and adjusting them to reach optima conditions.
- Also to be used for data collection and report generation.
Algorithmes de tri
####Tri par Insertion
- Consider the first $i$ items $T,...,T[i]$ of the table which are already organized, and insert the element $T[i+1]$ in its place among the first $i$ elements.
Algoritme
procedure tri_insertion(tableau T, entier n)
donnée : tableau T de n éléments
pour i de 2 à n faire
x ← T[i]
j ← i - 1
tant que j > 0 et T[j] > x faire
T[j+1] ← T[j]
j ← j - 1
fin tant que
T[j+1] ← x
fin pour
fin procedure
Complexité
- Worst case The table is already ordered inversely such that the calculation is:
$\qquad \sum_{i=2}^{n} (i-1) + i = \sum_{i=2}^{n} (2i-1) = 2 \frac{n(n+1)}{2} - 2 - (n-1) = n^2 + n - 2 - n + 1 = n^2 - 1$
-
Complexité of : $O(n^2)$.
-
Best case table is already organized: $O(n)$
-
Average case: complexité $O(n^2)$.
Avantages
- Implementation of concept is simple.
- Efficient for smaller tables.
- Accommodated into tables already almost organized.
- Stable, where the order of items are conserved.
- In place: Does not create use for more tables.
Inconvénients
- Inefficient against more larger tables
- Quadratic complex
Tri par Sélection
- A selection sort searches for the smallest element in the table and if they're badly organized, swap one with the first element. Then continue from the rest and search again from smaller one.
Algoritme
procedure tri_selection(tableau T, entier n)
donnée : tableau T de n éléments
pour i de 1 à n-1 faire
min ← i
pour j de i+1 à n faire
si T[j] < T[min] alors
min ← j
fin si
fin pour
si min ≠ i alors
echanger(T[i], T[min])
fin si
fin pour
fin procedure
Complexité
- Worst cast, the complexity of this operation is:
$\qquad \sum_{i=1}^{n-1} (n-i) = \sum_{i=1}^{n-1} i = \frac{n(n-1)}{2} = \frac{n^2 - n}{2}$
$O(n^2)$.
-
Best case The operation is, O(n^2)
-
Average case the complexity is, $O(n^2)$.
Avantages
- Simple
- Doesn't not create tables, in place.
- Minimal swaps
Inconvénients
- Inefficient for larger tables
- Quadratic complex Non stable and doesn't follow the order of the selected items.
Tri a bulles
- A "Bubble sort" travels around the table comparing and the organized swaps done based on the mal-aligned sorted items. The operations get repeated until no more swaps left.
Algoritme
procedure tri_bulles(tableau T, entier n)
donnée : tableau T de n éléments
répéter
echange ← faux
pour i de 1 à n-1 faire
si T[i] > T[i+1] alors
echanger(T[i], T[i+1])
echange ← vrai
fin si
fin pour
tant que echange
fin procedure
Complexité
-
Worst case, for a unorganized tabler, operations for each loop is the following is: - $n-i$ where it equals O(n^2);
-
Best case is is,
echange T a faux
With such, there's just
$ n-1$ for a $ O(n) time.
- Average: $O(n^2).
Avantages
- Simple
Inconvénients.
- Iffenficetn tables Quadratic Complex; Non stable doesn't follow elements set.
Tri Rapide (The quicksort).
Chooses and partitions the array. The two subarrays of the table which are recursive.
procedure tri_rapide(tableau T, entier debut, entier fin)
donnée : tableau T, entier debut, entier fin
si debut < fin alors
pivot ← partitionner(T, debut, fin)
tri_rapide(T, debut, pivot-1)
tri_rapide(T, pivot+1, fin)
fin si
fin procedure
procedure partitionner(tableau T, entier debut, entier fin)
donnée : tableau T, entier debut, entier fin
pivot ← T[fin]
i ← debut
pour j de debut à fin-1 faire
si T[j] ≤ pivot alors
echanger(T[i], T[j])
i ← i + 1
fin si
fin pour
echanger(T[i], T[fin])
retourner i
fin procedure
The complexity is, for the following:
Best case. O(n log n): Averagee case . O(n log n). And : In all O(n^2);
Avantages
- Efacicnet n larget tables, -in En palce where
Inconvénients
-Complex:
TrI Fusion
- Divide the table into a sub-table that has the same values
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.