Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you make a Function in Pseudocode

So I have given myself a task to make a Pseudocode BubbleSort Algorithm (In accending order) Function to use in a bigger program, I am quite new to Pseudocode so I would love the support. I have the Python Code: # Python: BubbleSort

def bubblesort(myList):
    for i in range(0, len(myList) - 1):
        for j in range(0, len(myList) - 1 - i):
            if myList[j] < myList[j+1]:
                myList[j], myList[j+1] = myList[j+1], myList[j]
                return myList

But how would I go about making this into Pseudocode?

like image 436
Jack Thomas Avatar asked Dec 05 '25 16:12

Jack Thomas


1 Answers

Pseudocode has no defined standard, as it is simply a method of writing a human-readable representation of program code. Functions can be defined however you wish. A few examples are:

  • def FunctionName(), as is the Python syntax for defining functions;
  • C-style <type> function name();
  • etc.

However you define functions in the end is up to you, and whether you choose to follow the syntax of the original source's language or not is only your decision to make.

More examples of pseudocode function declarations can be found here (en.wikipedia.org, "Pseudocode", section "Syntax").

like image 160
Ryos Avatar answered Dec 10 '25 20:12

Ryos



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!