How does the reviewing process works ?
How to write an Article – General Instructions ?
Formatting Issues while writing posts.
How to add Latex Code (For mathematical formulae and equations) ?
How to insert an image ?
How to add programming codes ?
How to write code in articles of Linked Lists ?
How to write code in articles of Trees ?
How to write Multiple Choice Questions (MCQs) ?
How to add table?
How to add code in existing articles ?

Reviewing Process:

Step 1: After writing the article, please submit it for review and the status of your article becomes pending.
Step 2: The team reviews your article and gives you feedback in comments under the article and saves your article status to Awaiting Author.
Step 3: Please improve your article according to the given feedback, and again submit the article for review. Now the status of your article becomes pending again.
Step 4: Finally, after you have made all the required improvements, your article status becomes In Review, it means it has been approved and is going to get published soon.
Step 5: When your article gets published, the status of your article becomes published.

  

How to write an Article ?

1) All problems should have examples with sample inputs, sample outputs and explanations. See below for example on this post. The examples should also be written in pre tags and width of text should not cross 60 characters.

Examples:

Input: n = 1
Output: 11
1 is first Fibonacci number in this representation
and an extra 1 is appended at the end.

Input:  n = 11
Output: 001011
11 is sum of 8 and 3.  The last 1 represents extra 1
that is always added. A 1 before it represents 8. The
third 1 (from beginning) represents 3.

2) Every problem statement should have at-least two examples with first example well explained.

3) Diagrams should use green color in text and black color in boundaries. More colors like Red, Blue can be used if needed. See this post for sample. If an image is taken from a source, the source should be specified with the image. See this article for example.

4) Formulas or any line that you want to be highlighted should be written in pre tags with characters till 60 columns so that they are readable on mobile devices also.

   
P = (x + y)(x - y)

pretag

  

Formatting Issues while writing posts ?

1) In post content (outside source codes), please use &lt; instead of < character to avoid formatting issues.

  

Adding Latex Code ?

We can add latex code using below syntax.

[Tex]Your_Latex_Code[/Tex]

For example, [Tex]x^y[/Tex] shows x^y

  

Inserting an Image ?

  1. Please use Add media button to upload an image

  2. Name of the image must be Relevant. For example if an image depicts” : “Adding of two numbers using Linked List”, the title of the image must be: Adding of two numbers using Linked List
  3. In case of formulae, Please try to write them using Latex option present in the tool-bar present on author’s copy.
  4. In case, the differences are present as tables, try to write them using html table tag (Please see table insertion guidelines).
  5. In case of images being built using packet tracer, please send the screen recording in place of image if possible.
  6. In case of screenshots, please add GeeksforGeeks (or GfG) somewhere in output. For example, it may be folder name, image title, etc.
  7. It is mandatory to create your own images using some image drawing tool (For Ex : Google Drawings, MS Paint, https://www.draw.io/). Images MUST NOT be taken from any other source to avoid any copyright issue. You can follow the below guidelines to create images in GeeksforGeeks style:
    • The boundary/outline of the image should be of black color.
    • The text to be written should be of green color.
    • Our priority should be to use white background, if other background colors are needed, please use green as background and white color in text.
    • Red color should be used to show movements, representations, variations and other things.
    • If more colors are required in the image, Please contact GeeksforGeeks’s reviewers to guide you.
  8. Please see below the example image, to get a clear idea about image creation:

    Array:
    Array


Writing Code ?

This is the source of many of the following coding standards.

1) Function and variable names follow camel case. For example, getMin(), getMax() and removeDuplicates(), isPresent etc.

2) Driver code (or main function) does not contain any logic. It contains only input/output and function call..

3) Indentation should be done using 4 spaces.

4) Maximum 60 characters in a line so that the program is readable on mobile devices without much horizontal scrolling.

// Below style should be avoided
int fun(int a, int sumSoFar, int currSum, char val, int *result)

// The above should be written as
int fun(int a, int sumSoFar, int currSum, char val,
        int *result)
    // Below style should be avoided
    cout << "Sample code to understand coding style for more readability of millions of readers" << val;

   // The above should be written as
   cout << "Sample code to understand coding style for"
        << " more readability of millions of readers"
        << val;

5) In case code is written in multiple languages like Python, Java and C/C++, the output of all codes should be same.

To write code in multiple languages use the format shown in the picture below

[tabby title="C"]
[sourcecode language="C"]
  // Your C Code
[/sourcecode]
[tabby title="C++"]
[sourcecode language="CPP"]
  // Your C++ Code
[/sourcecode]
[tabby title="Java"]
 [sourcecode language="Java"]
 // Your Java Code
[/sourcecode]
[tabby title="Python"]
[sourcecode language="Python3"]
   # Your Python3 Code
[/sourcecode]
[tabbyending]

To highlight a particular section of code, we can put beginning and ending line numbers using highlight.

// This will highlight code from line numbers 2
// to 4.
[sourcecode language="CPP" highlight="2-4"]
  // Your C++ Code
[/sourcecode]


// This will highlight code from line numbers 2
// to 4 and 10 to 12
[sourcecode language="CPP" highlight="2-4, 10-12"]
  // Your C++ Code
[/sourcecode]

In case your code does not compile or run due to any reason like libraries not supported by compiler, you wish to demonstrate errors, etc, please use HideRunIdeBtn to remove run buttons from the code. This button also avoids errors when your try to append output using “Append Output” button.

6) Avoid use of scanf (or cin) statements.

7) Spaces in while, if, else, for

    // There should be one space after while, no other
    // spaces
    while (i < 0)   

    if (x < y)
    {

    }

8) There should not be any spaces for function call or function declaration

// No spaces after "reverse" or after "("
void reverse(char* str, int low, int high)
{
    while (low < high)
    {
        swap(&str[low], &str[high]);
        ++low;
        --high;
    }
}   

// Driver program to test above function
int main()
{
   char str[] =  "geeksforgeeks";
   reverse(str);
   return 0;
}

9) Avoid the use of typdef.

10) Function names should be of the form “maxOfTwo()”, variable names should be of the form “max_of_two” or same as function name style. Class/Struct names should be of the form “ComplexNumber” or “SuffixTreeNode”. Macro names should be in capital letters like MAX_SIZE.

11) Avoid use of static and global variables.

12) When we use cout, we must use a space between cout and “<<” and space between two “<<“. For example:

cout << "Sample" << "Example"

13) There should be space after comma in declaration list and parameter passing.

int x, y, z;
fun(x, y, z);

14) There should be spaces in assignment operators

// Should be avoided
int x, y=0;

// Should be followed
int x, y = 0;

// Should be avoided
x+=10;

// Should be followed
x += 10;

 

15) In the beginning of every program, please write a line to tell the purpose of program:

// Java program to illustrate sum of two numbers 

Note : It is strongly recommended to add time complexity after your code in data structures/algorithm articles.

Linked List

1) For writing linked list posts, use the standard functions that have been used in all linked list posts on GfG. There may be exceptions when linked List is customized for a particular problem.

/* A utility function to print linked list */
void printList(struct Node *node)
{
    while (Node != NULL)
    {
        printf("%d  ", node->data);
        node = node->next;
    }
}

2) In main(), create a hard coded linked list instead of using scanf or cin. For example, following list.

// Function to create newNode in a linkedlist
Node* newNode(int key)
{
    Node *temp = new Node;
    temp->data = key;
    temp->next = NULL;
    return temp;
}

int main()
{
    Node *head = newNode(1);
    head->next = newNode(2);
    head->next->next = newNode(3);
    head->next->next->next = newNode(4);
    head->next->next->next->next = newNode(5);
}

Tree

1) For writing tree posts, use the standard structure and functions that have been used in most of the tree programs on GfG. There may be exceptions when tree is customized for a particular problem.

// A Tree node
struct Node
{
    int key;
    struct Node* left, *right;
};
 
// Utility function to create a new node
Node* newNode(int key)
{
    Node* temp = new Node;
    temp->key = key;
    temp->left = temp->right = NULL;
    return (temp);
}
 
// Driver program
int main()
{
    // Let us create Binary Tree shown in above example
    Node *root  = newNode(1);
    root->left  = newNode(12);
    root->right = newNode(13);
 
    root->right->left   = newNode(14);
    root->right->right  = newNode(15);
 
    root->right->left->left   = newNode(21);
    root->right->left->right  = newNode(22);
    root->right->right->left  = newNode(23);
    root->right->right->right = newNode(24);
}

2) In main(), create a hard coded tree instead of using scanf or cin. For example, following tree.

// Driver program
int main()
{
    /*   10
       /     \
     12       13
           /     \
         14       15    
        /   \     /  \
       21   22   23   24           
    Let us create Binary Tree shown in above example */
    Node *root  = newNode(10);
    root->left  = newNode(12);
    root->right = newNode(13);
 
    root->right->left   = newNode(14);
    root->right->right  = newNode(15);
 
    root->right->left->left   = newNode(21);
    root->right->left->right  = newNode(22);
    root->right->right->left  = newNode(23);
    root->right->right->right = newNode(24);
}

Will be adding more to it.

See following for any other doubt.

http://users.ece.cmu.edu/~eno/coding/CCodingStandard.html

Writing Multiple Choice Questions

  1. Please add MCQS of same topic in one set(Can be of 5 to 10 questions) and put a Prerequisite link in the beginning for the topic you are writing. like this – Prerequisite – Overloading in Java. Please see this article for sample – Output of Java program | Set 22 (Overloading)
  2. Please use “GeeksforGeeks” wherever string is being used or any meaningful name rather than a, b, x, y.
  3. Please maintain the following format: 1) What is the output of the following program? for all questions
  4. At the end or in between the article, please give hyperlinks to GeeksforGeeks articles which mayever apply

How to add Table?

It is recommended to follow below look and feel in tables

Below is HTML syntax to add above table.

<table width="100%" style="table-layout:fixed;">
<thead>
<tr>
<th>Head1</th>
<th>Head2</th>
<th>Head3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Column1</td>
<td>Column2</td>
<td>Column3</td>
</tr>
<tr>
<td>Column1</td>
<td>Column2</td>
<td>Column3</td>
</tr>
</tbody>
</table>