fix: replace c++ with cpp for language postfix
This commit is contained in:
committed by
Kristofer Koishigawa
parent
7d097e62ac
commit
22f52296bc
@ -12,7 +12,7 @@ Depth First Search is one of the most simple graph algorithms. It traverses the
|
||||
|
||||
### Implementation (C++14)
|
||||
|
||||
```c++
|
||||
```cpp
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
@ -93,7 +93,7 @@ Worse Case Time Complexity: O(n)
|
||||
Depth First Search is complete on a finite set of nodes. I works better on shallow trees.
|
||||
|
||||
### Implementation of DFS in C++
|
||||
```c++
|
||||
```cpp
|
||||
#include<iostream>
|
||||
#include<vector>
|
||||
#include<queue>
|
||||
|
@ -108,7 +108,7 @@ public class BubbleSort {
|
||||
}
|
||||
```
|
||||
### Example in C++
|
||||
```c++
|
||||
```cpp
|
||||
// Recursive Implementation
|
||||
void bubblesort(int arr[], int n)
|
||||
{
|
||||
|
@ -64,7 +64,7 @@ public class Heapsort {
|
||||
}
|
||||
```
|
||||
Implementation in C++
|
||||
```C++
|
||||
```cpp
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
void heapify(int arr[], int n, int i)
|
||||
|
@ -11,7 +11,7 @@ To print things to the console, or read from it, you use `cout` and `cin`, which
|
||||
The "Hello World" program uses `cout` to print "Hello World!" to the console:
|
||||
|
||||
```cpp
|
||||
#include<iostream.h>
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
|
@ -15,7 +15,7 @@ title: Map
|
||||
|
||||
Here is an example:
|
||||
|
||||
```c++
|
||||
```cpp
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
@ -66,7 +66,7 @@ size of map is 1
|
||||
## Insertion
|
||||
Inserting data with insert member function.
|
||||
|
||||
```c++
|
||||
```cpp
|
||||
myMap.insert(make_pair("earth", 1));
|
||||
myMap.insert(make_pair("moon", 2));
|
||||
```
|
||||
@ -114,7 +114,7 @@ value of def is 2
|
||||
## Accessing map elements
|
||||
|
||||
To access map elements, you have to create iterator for it. Here is an example as stated before.
|
||||
```c++
|
||||
```cpp
|
||||
map<char, int>::iterator it;
|
||||
for(it=first.begin(); it!=first.end(); ++it){
|
||||
cout << it->first << " => " << it->second << '\n';
|
||||
|
@ -17,7 +17,7 @@ Algumas operações básicas da pilha são:
|
||||
|
||||
A implementação de uma pilha é possível usando arrays ou listas vinculadas. A seguir, uma implementação de matriz simples da estrutura de dados da pilha com suas operações mais comuns.
|
||||
|
||||
```C++
|
||||
```cpp
|
||||
//Stack implementation using array in C++
|
||||
//You can also include<stack> and then use the C++ STL Library stack class.
|
||||
|
||||
|
@ -37,7 +37,7 @@ A instrução de atualização é usada para alterar a variável de loop usando
|
||||
|
||||
## IMPLEMENTAÇÃO:
|
||||
|
||||
```C++
|
||||
```cpp
|
||||
#include <iostream>
|
||||
using namespace std; // Here we use the scope resolution operator to define the scope of the standar functions as std::
|
||||
|
||||
|
@ -8,13 +8,13 @@ localeTitle: Массивы C ++
|
||||
|
||||
Например, массив, содержащий 5 целых чисел (int), объявляется так:
|
||||
|
||||
```C++
|
||||
```cpp
|
||||
int numbers [5];
|
||||
```
|
||||
|
||||
Начальное заполнение значений при объявлении массива (initializiation):
|
||||
|
||||
```C++
|
||||
```cpp
|
||||
//Initialization with entries:
|
||||
int numbers [5] = {1, 2, 3, 4, 5};
|
||||
|
||||
@ -34,7 +34,7 @@ int numbers [5];
|
||||
Элементы из массива можно получить через ссылку на их позицию в массиве. (Отсчет начинается с 0).
|
||||
Пример:
|
||||
|
||||
```C++
|
||||
```cpp
|
||||
x = numbers[0]; // = 1. [0] == first position
|
||||
numbers[2] = 55; // Sets the third position (3) to the new number 55
|
||||
//numbers[] is now: {1, 2, 55, 4, 5}
|
||||
|
@ -174,7 +174,7 @@ int binarySearch(int a[], int l, int r, int x) {
|
||||
|
||||
### Implementación C / C ++
|
||||
|
||||
```C++
|
||||
```cpp
|
||||
int binary_search(int arr[], int l, int r, int target)
|
||||
{
|
||||
if (r >= l)
|
||||
@ -208,7 +208,7 @@ def binary_search(arr, l, r, target):
|
||||
|
||||
### Ejemplo en C ++
|
||||
|
||||
```c++
|
||||
```cpp
|
||||
// Binary Search using iteration
|
||||
int binary_search(int arr[], int beg, int end, int num)
|
||||
{
|
||||
@ -225,7 +225,7 @@ def binary_search(arr, l, r, target):
|
||||
}
|
||||
```
|
||||
|
||||
```c++
|
||||
```cpp
|
||||
// Binary Search using recursion
|
||||
int binary_search(int arr[], int beg, int end, int num)
|
||||
{
|
||||
|
@ -8,13 +8,13 @@ Una matriz es una serie de elementos del mismo tipo de datos que se almacenan en
|
||||
|
||||
Por ejemplo, una matriz que contiene 5 valores enteros llamados números se declara así:
|
||||
|
||||
```C++
|
||||
```cpp
|
||||
int numbers [5];
|
||||
```
|
||||
|
||||
Inicialización:
|
||||
|
||||
```C++
|
||||
```cpp
|
||||
//Initialization with entries:
|
||||
int numbers [5] = {1, 2, 3, 4, 5};
|
||||
|
||||
@ -34,7 +34,7 @@ Inicialización:
|
||||
Se puede acceder a los elementos de una matriz a través de la referencia de su posición en la matriz. (Comience contando desde 0).
|
||||
Ejemplo:
|
||||
|
||||
```C++
|
||||
```cpp
|
||||
x = numbers[0]; // = 1. [0] == first position
|
||||
numbers[2] = 55; // Sets the third position (3) to the new number 55
|
||||
//numbers[] is now: {1, 2, 55, 4, 5}
|
||||
|
@ -37,7 +37,7 @@ La instrucción de actualización se usa para alterar la variable del bucle medi
|
||||
|
||||
## IMPLEMENTACIÓN:
|
||||
|
||||
```C++
|
||||
```cpp
|
||||
#include <iostream>
|
||||
using namespace std; // Here we use the scope resolution operator to define the scope of the standar functions as std::
|
||||
|
||||
|
Reference in New Issue
Block a user