Diff
checker
Texto
Texto
Imagens
Documentos
Excel
Pastas
Legal
Enterprise
Aplicativo para desktop
Preços
Fazer login
Baixar o Diffchecker Desktop
Comparar texto
Encontre a diferença entre dois arquivos de texto
Ferramentas
Histórico
Editor live
Recolher inalteradas
Sem quebra de linha
Layout
Dividido
Unificado
Nível de detalhe
Inteligente
Palavra
Caractere
Realce de sintaxe
Escolher sintaxe
Ignorar
Transformar texto
Ir à primeira mudança
Editar entrada
Diffchecker Desktop
A maneira mais segura de usar o Diffchecker. Obtenha o aplicativo Diffchecker Desktop: seus diffs nunca saem do seu computador!
Obter Desktop
Untitled Diff
Criado
há 4 anos
O diff nunca expira
Limpar
Exportar
Compartilhar
Explicar
7 remoções
Linhas
Total
Removido
Caracteres
Total
Removido
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
27 linhas
Copiar tudo
7 adições
Linhas
Total
Adicionado
Caracteres
Total
Adicionado
Para continuar usando este recurso, atualize para
Diff
checker
Pro
Ver preços
27 linhas
Copiar tudo
Copiar
Copiado
Copiar
Copiado
//
Fenwick tree
class
//
BIT
class
class
FenwickTree
{
class
BIT
{
// Array to store the
Fenwick tree
// Array to store the
BIT
vector<int> tree;
vector<int> tree;
public:
public:
Copiar
Copiado
Copiar
Copiado
// Constructor to create an empty
Fenwick tree
with the given size
// Constructor to create an empty
BIT
with the given size
FenwickTree
(int size) : tree(size + 1) { }
BIT
(int size) : tree(size + 1) { }
Copiar
Copiado
Copiar
Copiado
// Add the given value at the given index in the
Fenwick tree
// Add the given value at the given index in the
BIT
void add(int index, int value) {
void add(int index, int value) {
while (index < tree.size()) {
while (index < tree.size()) {
tree[index] += value;
tree[index] += value;
index += index & -index;
index += index & -index;
}
}
}
}
Copiar
Copiado
Copiar
Copiado
// Query the
Fenwick tree
for the prefix sum at the given index
// Query the
BIT
for the prefix sum at the given index
int query(int index) {
int query(int index) {
int sum = 0;
int sum = 0;
while (index > 0) {
while (index > 0) {
sum += tree[index];
sum += tree[index];
index -= index & -index;
index -= index & -index;
}
}
return sum;
return sum;
}
}
};
};
Diferenças salvas
Texto original
Abrir arquivo
// Fenwick tree class class FenwickTree { // Array to store the Fenwick tree vector<int> tree; public: // Constructor to create an empty Fenwick tree with the given size FenwickTree(int size) : tree(size + 1) { } // Add the given value at the given index in the Fenwick tree void add(int index, int value) { while (index < tree.size()) { tree[index] += value; index += index & -index; } } // Query the Fenwick tree for the prefix sum at the given index int query(int index) { int sum = 0; while (index > 0) { sum += tree[index]; index -= index & -index; } return sum; } };
Texto alterado
Abrir arquivo
// BIT class class BIT { // Array to store the BIT vector<int> tree; public: // Constructor to create an empty BIT with the given size BIT(int size) : tree(size + 1) { } // Add the given value at the given index in the BIT void add(int index, int value) { while (index < tree.size()) { tree[index] += value; index += index & -index; } } // Query the BIT for the prefix sum at the given index int query(int index) { int sum = 0; while (index > 0) { sum += tree[index]; index -= index & -index; } return sum; } };
Encontrar Diferença