The Python heap sorting algorithm in less than 128 words

The principle of the heap sorting algorithm is as follows:

  • We search for the father of the last knot of the tree and we sift it: the father of a knot in a binary tree corresponds to the lower round of (i-1)/2 with i the position of the knot in the table that stores the tree.
  • Sieving a knot involves visiting his right and left son and swapping the root with the larger of the two.
  • The tree is sifted until it reaches the root, the largest number of the tree is then in the root position at the beginning of the painting.
  • The root that is the largest number is swapped with the last leaf (i.e. the n position of the table that stores the n-size tree). This number is considered to be well ordered (i.e. it is in last position and it is the largest)
  • The sieving and swapping operation is repeated by considering the subtree that goes from root to n-1 (so as not to move the number that has been correctly ordered) until we reach the left wire of the root (index 1)

See wikipedia link: https://fr.wikipedia.org/wiki/Tri_par_tas

from math import
#128mots.com
def indice_fils_gauche (noeud_pere:int):
	return (noeud_pere - 2) - 1

def indice_fils_droit (noeud_pere:int):
	return (noeud_pere - 2) - 2
#Retourne the pere node index if it exists (node must be 0)
def indice_noeud_pere(knot):
	#Si it is the lower rounding of (knot-1)/2
	return floor (knot - 1)/2)

#permute 2 elements of a table and incrementally the overall variable compteur_permutation to be initialized in the hand
def permute (table, index1: int, index2:int):
	print ("Permutation of the element" - str (index1) - "with element" - str (index2))
	print(" Before permutation: " - str (table))
	globalcompteur_permutation
	if (index1!2):
	#on back up the value of Index 1 in a temporary variable
		tmp - table[indice1]
		table[indice1] - table[indice2]
		table[indice2] - tmp
		compteur_permutation 1
	print(" After permutation: " - str (table))

#Tamise a binary tree from a parametre knot
#1. the knot is compared with the right and left wire (if they exist)
#2. we swap with the highest value
#128mots.com
def thames (tree, knot, length):
	#On visits right and left son
	print ("Tamisage of" - str (knot) - " tree: " - str (tree)	
	indexSonRight - indice_fils_droit (knot)
	IndexLeft - indice_fils_gauche (knot)
	print ("IndexSonRight" - str (indexSon))
	print ("Left-hand index"" - str (left-hand index)


	if (indexSonRight< longueur): # si le fils droit existe longueur):="" #="" si="" le="" fils="" droit=""></ longueur): # si le fils droit existe>
		if (tre[indiceFilsDroit]e- tree[indiceFilsGauche]): #Si the right son is larger than the left wire
			if (tre[indiceFilsDroit]e- tree[noeud]): #Si the right wire is larger than the sifted knot
				permute (tree, indexSonright,knot)
		elif (tre[indiceFilsGauche]e - tre[noeud]e): #Si the left wire is higher than the sifted knot, so you swap
			permute (tree, left-hand index, knot)
	elif (Left-hand index< longueur): #Si le fils gauche existe longueur):="" #si="" le="" fils="" gauche=""></ longueur): #Si le fils gauche existe>
		if (tre[indiceFilsGauche]e - tre[noeud]e): #Si the left wire is higher than the sifted knot so we swap
			permute (tree, left-hand index, knot)
	print(" After sieving: " - str (tree))			
#128mots.com

compteur_permutation 0
tree - #[11, 222, 3, 24, 5, 46, 67, 899]On writes a tree in the form of a painting
print ("starting tree: " - str (tree)

#128mots.com
#Tamisage initial
#on takes the last element of the arbe which is a leaf and one looks for his father
IndexDuNoeudPere - indice_noeud_pere (tree)-1) 
#on sifting is compared to the father knot with the right and left son
#puis you swap with the highest value
for i in range (DuNoeudPere index,-1,-1): #On siftto to the root
	thames (tree,i,len (tree)

permute (tree, len (tree)-1.0) #on swaps the first element and the last 
#suite sieving is the greatest value so it is placed at the end of the table

#on repeats the sieving
for i in range(len(tree)-1,1,-1): 
	indexDuNoeudPereDeI - indice_noeud_pere (i-1) #on takes the element i of the arbe which is a sheet and one looks for his father
	for j in range (duKnotPereDeI index,-1,-1): #On siftto to the root
		thames (tree, j,i)
	permute (tree, i-1.0)

print ("final result of sorting: " - str (tree))
print ("number of permutations: " - str(compteur_permutation))

Filius server, switch, TCP in less than 128 words

I install the “command line” on the A computer and launch the ipconfig command to check the IP address of the post, the subnetwork mask and the physical address (MAC address).

View exchanged data: ICMP packages correspond to a “ping” query executed via the command line. To learn more about the ICMP protocol:

https://fr.wikipedia.org/wiki/Internet_Control_Message_Protocol

Adding a server and switch: It is then possible to set up a post as a “generic client” and the server as a “generic server.” We establish a connection between the client and the server and then exchange a message.

The data exchanged is displayed and a TCP/IP connection is established.

If __name__ '__main__' in Python scripts in less than 128 words

When writing a Python module there is no hand method, for example the script stade.py

def players():
    print ("Go blues")
 
players()

If we start the script "python stade.py" we get "Go blues" the function is started.

If I create a script championnat.py that mattersstade.py

stadium import

def equipe():
    print ("Equipe")
 
team()

You get by starting "python championnat.py"

championnat.py python 
Go blues
Team

Here we consider that the players function of the stadium module is started.

To avoid this, we can change the script stade.py:

def players():
    print ("Go blues")
If __name__ '__main__' 
	players()

Filius command ping in less than 128 words

Filius is a network simulation software. This first article presents the creation of an ad hoc network between two computers and the use of the ping command.

Step 1: Add the two computers and connect them via a network cable.

Filius configuration of a network of 2 computers

Step 2: Set up the name and IP address of computers, i.e. "Computer A": 198.168.0.10 and "Computer B": 198.168.0.20

Step 3: Start and install the command line on computer A by clicking on it.

FIlius installation of command line on computer A

Step 4: Use the ping command 192.168.0.20. Ping is an order that sends network packages to the requested address and measures response times.

Ping

Comment faire un ping sur Filius ? – Commande Ping

comment faire un ping sur filius. Filius est un logiciel de simulation de réseau. Comment faire une commande ping sur Filius ? Ce premier article présente la création d’un réseau ad hoc entre deux ordinateurs et l’utilisation la commande ping.

Etape 1 :

Ajouter les 2 ordinateurs et les relier par un câble réseau.

Filius ping - Comment faire un ping sur Filius ?
Filius configuration d’un réseau de 2 ordinateurs

Etape 2 :

Configurer le nom et l’adresse IP des ordinateurs, soit “Ordinateur A” : 198.168.0.10 et “Ordinateur B” : 198.168.0.20

Filius ping - Comment faire un ping sur Filius ?

Etape 3 :

Démarrer et installer la ligne de commande sur l’ordinateur A en cliquant dessus.

Filius ping - Comment faire un ping sur Filius ?
FIlius installation de la ligne de commande sur ordinateur A

Etape 4 :

Utiliser la commande ping 192.168.0.20. Ping est une commande qui envoie des paquets réseau vers l’adresse demandée et qui mesure les temps de réponse.

Filius ping - Comment faire un ping sur Filius ?
Commande ping

Filius ping – Liens Externes

https://www.ionos.fr/digitalguide/serveur/outils/commande-ping/

https://fr.wikipedia.org/wiki/Ping_(logiciel)

https://www.cisco.com/c/fr_ca/support/docs/ip/routing-information-protocol-rip/13730-ext-ping-trace.html

Filius ping -Liens Internes

https://128mots.com/index.php/en/category/non-classe-en/

https://128mots.com/index.php/category/non-classe/

https://128mots.com/index.php/2021/01/26/ordinateur-quantique-prix/

Python fast sorting in less than 128 words

Quick sorting (QuickSort) randomly select an element (called pivot) and position it in its final place, swapping all the elements so that those below the pivot are to its left and those above the pivot to its right.

The operation is called partitioning. For each sub-list (or sub-table), a new pivot is randomly selected and the partitioning operation is repeated. This process is repeated recursively, until all items are sorted.

The partitioning consists of:

  • swap the pivot with the last element of the subtable
  • place at the top of the sub-table the elements below the pivot
  • move the pivot to the right of the last item moved at the beginning of the table (the other elements being higher than the pivot).
Example of a partitioning iteration (source wikipedia): Here the pivot is 5
from random import randint 


#Choix of a pivot randomly
#128mots.com
def choix_pivot (table, first: int,last: int):
	pivot - randint (first, last) 
	print ("The unsorted sub-list is: " - str(table[premier:dernier+1]))
	print ("The pivot chosen aleatially is the index " str (pivot) - "value" - str (table[pivot]))
	pivot return

#Fonction to partition the board
#Permutation of all the elements so that those that are below the pivot
to his left and all those who are superior to the pivot 
#soient to his right. 
#128mots.com
def partition (table, beginning: int, end: int, pivot: int):
	#Etape 1: The pivot is positioned at the end of the sublist arbitrarily	
		#On swaps the pivot and the last element
	print ("Partitioning of the sub-list " - str(table[debut:fin+1]))
	print ("---Placement from pivot to end sublist")
	permute (table, pivot, end)
	print ("---")

	j - start #indice of progress at the beginning of the sub-list
	#Pour i from the beginning of the sublist to the end
	for i in range (debut,fin):	
	#Tous the lower-pivot elements are placed at the beginning of the sub-list
		if (tab<= [i]tab):></= ta[fin]b):>
		#Si the value is lower we move at the beginning of the table
		#Et that the value is not already well placed so we move to the beginning of the table
			permute (table,i,j)
			J.1	
	#On puts the pivot in the right place by swapping the item after the last found as below the pivot
	print ("permutation of the pivot")
	permute (table, fine, j)
	#on returns j's position which is then the new position of the pivot in the table
	return j	


#Fonction swapping two elements of a table
#128mots.com
def permute (table, index1: int, index2:int):
	print ("Permutation of the element" - str (index1) - "with element" - str (index2))
	print(" Before permutation: " - str(tab))
	globalcompteur_permutation
	if (index1!2):
	#on back up the value of Index 1 in a temporary variable
		tmp - table[indice1]
		table[indice1] - table[indice2]
		table[indice2] - tmp
		compteur_permutation 1
	print(" After swapping: " - str(tab))

#Fonction of rapid sorting of a sub-list of a table
#128mots.com
def tri_rapide (table,debut: int,fin: int):
	If you have a sub-list that contains at least 2 items
	If debut< fin : fin=""></ fin :>
		#on chooses a pivot in the sub-list
		pivot - choix_pivot (table, beginning, end)
		#on moves all the lower elements to the pivot to the left of the pivot
		pivot - partition (table, beginning, fine, pivot)
		#recursion to redo the algorithm on the sublist to the left of the found pivot
		tri_rapide (table,debut,pivot - 1)
		#recursion to redo the algorithm on the sublist to the right of the found pivot
		tri_rapide (table, pivot - 1,fin)


compteur_permutation 0
tab[111, 34, 22, 55, 4, 2, 1, 77]
tri_rapide (tab,0,len(tab)-1)
print ("final result of sorting: " - str(tab))
print ("number of permutations: " - str(compteur_permutation))

The release of the program is as follows:

The unsorted sub-list is:[111, 34, 22, 55, 4, 2, 1, 77]
The pivot chosen aleatially is the index 6 of value 1
Partitioning of the sub-list[111, 34, 22, 55, 4, 2, 1, 77]
---Placement from pivot to end sublist
Swap element 6 with element 7
Before permutation:[111, 34, 22, 55, 4, 2, 1, 77]
After swapping:[111, 34, 22, 55, 4, 2, 77, 1]
---
Permutation of the pivot
Swap element 7 with element 0
Before permutation:
After swapping:
The unsorted sub-list is:
The pivot chosen aleatially is the 5-value index
Partitioning of the sub-list
---Placement from pivot to end sublist
Swap element 5 with element 7
Before permutation:
After swapping:
---
Permutation of the pivot
Swap element 7 with element 1
Before permutation:[1, 34, 22, 55, 4, 111, 77, 2]
After swapping:[1, 2, 22, 55, 4, 111, 77, 34]
The unsorted sub-list is:[22, 55, 4, 111, 77, 34]
The pivot chosen aleatially is the 4-value index
Partitioning of the sub-list[22, 55, 4, 111, 77, 34]
---Placement from pivot to end sublist
Swap pingofing element 4 with element 7
Before permutation:
After swapping:
---
Permutation of the pivot
Swap element 7 with element 2
Before permutation:
After swapping:
The unsorted sub-list is:
The pivot chosen aleatially is the index 4 of value -34
Partitioning of the sub-list
---Placement from pivot to end sublist
Swap pingofing element 4 with element 7
Before permutation:
After swapping:
---
Swap element 4 with element 3
Before permutation:[1, 2, 4, 55, 22, 111, 77, 34]
After swapping:[1, 2, 4, 22, 55, 111, 77, 34]
Permutation of the pivot
Swap element 7 with element 4
Before permutation:
After swapping:
The unsorted sub-list is:[111, 77, 55]
The pivot chosen aleatially is the 5 index of value -111
Partitioning of the sub-list[111, 77, 55]
---Placement from pivot to end sublist
Swap element 5 with element 7
Before permutation:
After swapping:
---
Swap element 5 with element 5
Before permutation:
After swapping:
Swap element 6 with element 6
Before permutation:
After swapping:
Permutation of the pivot
Swap element 7 with element 7
Before permutation:[1, 2, 4, 22, 34, 55, 77, 111]
After swapping:[1, 2, 4, 22, 34, 55, 77, 111]
The unsorted sub-list is:[55, 77]
The pivot chosen aleatially is the index 6 of value '77
Partitioning of the sub-list[55, 77]
---Placement from pivot to end sublist
Swap element 6 with element 6
Before permutation:
After swapping:
---
Swap element 5 with element 5
Before permutation:
After swapping:
Permutation of the pivot
Swap element 6 with element 6
Before permutation:
After swapping:
final result of sorting:[1, 2, 4, 22, 34, 55, 77, 111]
permutation number: 10

The number of permutation switching is 10 for a table of 8 elements.

The average complexity of rapid sorting is 7.22 for a table of 8 elements.

Filius download network simulator and filius mac download

Filius is a network simulation software. Here we explain the filius download and install filius mac os (filius für mac, filius macos) and filius ubuntu (filius linux). Its use is interesting in the context of the "Understanding the functioning of a computer network"

Filius is a network simulation software. Here we explain the filius download and install filius mac os (filius für mac, filius macos) and filius ubuntu (filius linux). Its use is interesting in the context of the “Understanding the functioning of a computer network”. This article briefly describes the installation of the software and the configuration on a linux/Mac bone post.

Step 1 filius download: I downloaded the filius software

It is available on the site in German: https://www.lernsoftware-filius.de/HerunterladenI a
lso created a link translated by google that is here: http
s://translate.google.com/translate?hl=fr&sl=de&u=https://www.lernsoftware-filius.de/Herunterladen&prev=search

For MAC OS I downloaded the ZIP file

Step 2 filius mac download – Filius linux : command to setup filius

On MAC OS or linux you have to start a terminal and go into the directory that contains the downloaded .zip file.

On MAC OS I typed the command

Downloads cd/ 

I’ve dezipped the archive in my user directory

unzip filius-1.7.4.zip -d

I executed the following commands to return to my user directory and view the contents of the package that was dezippé.

Cd 
cd filius
Ls

I get the content of the directory displayed

 Changelog.txt GPLv2.txt hilfe
 Einfuehrung_Filius.pdf GPLv3.txt img
 Filius.command Introduction_Filius.pdf lib
 Filius.exe config tmpl
 Filius.sh filius.jar

Filius is a program compiled in Java in the Filius.jar archive.
For MAC OS and Linux there is a File Filius.command that allows to launch the program via the JVM.

The file contains the following commands if viewed via the cat command

Filius.command cat

Script filius mac download – The script displayed is:

'!/bin/bash'
# 
This script is meant as supportive start script for
UNIX-like systems, e.g., Linux or Mac OS X
#
echo "Possible parameters:"
echo -e "-t-l'twrite log file 'filius.log'"
echo -e ''t-wd <path>'tchange base directory for working directory '.filius'"</path>
Echo

change to directory where filius is installed
relpath-$0
cd $'relpath%'basename $0'

Start filius
java -jar filius.jar $ @

change back to former directory
Cd - 'dev/null'

The important command in this script is java-jar filius.jar $that. It is used to launch the Filius software via the JVM. We find that it is possible to start the script with the setting -l to logue in a file and -w to change the default work directory.

Step 3: Shortcut to the filius macos, filius ubuntu or filius linux

I’ve added the running rights to the script via the chmod’x command to allow it to run

chmod x Filius.command

Step 4 run filius mac download: I execute Filius via the command

./Filius.command

Filius runs and starts, note that the ‘no’ allows you to block the terminal

On MAC OS it is possible after executing the previous command chmod x Filius.command to start Filius via the graphical interface in finder.

Step 5: Finder in macos

I went into Finder in the filius directory in which the downloaded archive is unzipped. I clicked twice on Filius.command and I get the message

It’s impossible to open Filius.command because this app comes from an unidentified developer.

Step 6: filius.command

I went to System Preference – General Tab Security and Privacy. In the second part it is noted “Allow downloaded applications from:” and we see “The opening of Filius.command” is blocked because the application comes from an unidentified developer.

I clicked “Open anyway” and then “Open”

The Filius app can then be started from the Finder by clicking “Filius.command.”

Step 7 filius mac download : To add a shortcut in the Dock MAC OS to filius you need to create a .app with the Filius.command script

I used the appify script of Thomas Aylott, here https://gist.github.com/mathiasbynens/674099.

You have to open a text editor and I pasted the code of the script in the link above by saving it in a appify.sh file. It’s also possible to do it online with nano for example and I then pasted a shortened version of the script:

nanoappify.sh
'!/usr/bin/env bash

APPNAME-$$-2:$(basename "${1}" '.sh')
DIR"$-APPNAME.app/Contents/MacOS";

If[ -a "${APPNAME}.app" ]; Then
    echo "$-PWD/$-APPNAME.app already exists :(";
    Exit 1;
fi;

mkdir -p "$-DIR";
cp "${1}" "$-DIR/$-APPNAME";
chmod 'x '$'DIR'/$'APPNAME';

echo "$-PWD/$APPNAME.app";

After recording via Ctrl-X and then “Y” you must allow the script to run via the command:

chmod x appify.sh

The next order converts Filius.command to Filius.app

./appify.sh Filius.command "Filius"

Message confirms the creation of Filius.app

I then moved the .app to Filius.app in my user directory and then copied the entire Filius directory recurringly into the mac os package created via the 2 commands.

mv Filius.app/
cp -r - Filius.app/Contents/MacOS/

The app is now in the main user’s directory (it can be accessed via finder via the home icon). It can then be slid to the Dock Mac Bone.

How to change the language used by Filius:

If you want to re-post the menu to choose the language in filius just erase the settings recorded by filius via the terminal command:

rm -r.filius

filius download : Internal links :

https://128mots.com/index.php/category/non-classe/

https://128mots.com/index.php/en/category/non-classe-en/

Sitemap for WordPress in less than 128 words

Step 1: I'm looking for the plugin "Yoast SEO", I install it and activate it via the Menu Extensions – Add.
Step 2: SEO – Dashboard – Features
Step 3: At the XML site plan level I click on the question mark and then "See the XML site plan"
Step 4: Import the address to Google search console to improve your site's indexing

Internet and WEB historical landmark in less than 128 words

The major stages of Internet development

< 1945 – 1970 : Les premiers réseaux, les premiers acteurs et les problématiques techniques émergent. 1945="" -="" 1970="" :="" les="" premiers="" réseaux,="" les="" premiers="" acteurs="" et="" les="" problématiques="" techniques=""></ 1945 – 1970 : Les premiers réseaux, les premiers acteurs et les problématiques techniques émergent.>
1970 – 1990: ARPANET, INTERNET, T
CP/IP 1990 – 2000: Internet
and Web 2000: WEB 2.0 and semantics develops.

The 3 layers of the internet:

The browser's content and app
Technical Standard – TCP / IP
Infrastructure – Medium telecommunications (radio, satellite, telephone …)

THE WEB
: Hypertext: Two-way links between documents (Paul Otlet)

Sorting by selection in Python

tab[111, 34, 22, 55, 4, 2, 1, 77]

for i in range (0,len(tab)-1):
	min i
	for j in range (i-1,len(tab):c)
		if tab<tab[j]:></tab[min]:>
			min - J
	if (min!
		tmp - tab[i]
		ta[i]b-tab[min]
		tab[min] - tmp

print (tab)

If we consider the "if tab" comparison operation<tab" et n la taille du tableau. et="" n="[j]" la=""[min] taille="" du=""></tab" et n la taille du tableau.>

If i -0 -0 (n-1) comparisons

If i – 1 – (n-2) comparisons

… If i 'n-2' – 1 comparison

or n – (n-1) comparisons

So the loop for i in range (0,len(tab)-1): runs n-1 times

The for j in range loop (i-1,len(tab):runs (n-(i-1) – 1) times

The complexity in the number of comparisons is equal to the sum of the following n-1 terms (i – 1, … i – n-1)

C – (n-2) -1 – (n-3) -1…..-1-0 -1-0 -(n-1)–(n-2)-…-1 -n.(n-1)/2 (this is the sum of the entire first n-1).

The complexity in the number of comparisons is in the order of n2, one writes O(n2).