View binary_insertion_sort.c
// Function to sort an array a[] of size 'n' | |
void insertionSort(int a[], int n) | |
{ | |
int i, loc, j, k, selected; | |
for (i = 1; i < n; ++i) | |
{ | |
j = i - 1; | |
selected = a[i]; | |
View stones_generating-binary-sequences
#include <bits/stdc++.h> | |
using namespace std; | |
bool b[18]; | |
int n; | |
void get(int a,int n) | |
{ | |
for ( int i= 0; i < n; i ++) | |
{ | |
if (a%2==0) b[i]=false; | |
else b[i]=true; |
View spiral_array.c
//Array in a spiral | |
int main() | |
{ | |
int i,j,n,w=3,l=0; // w и l - позволяют ориентироваться внутри массива | |
//w - отступ до дальней стенки, l - отступ от ближней | |
int a[4][4]={5,3,2,7,1,8,4,3,2,6,9,7,5,6,3,2}; //Массив 4 на 4 | |
i=0; | |
j=0; | |
for (n=0;n<16;++n) //Повторяется *кол-во элементов* раз |
View matrix.cpp
//matrix_multiplication | |
int main() | |
{ | |
int a, b, c, d; | |
// Entering the matrices dimensions | |
do | |
{ | |
cout << "M1 dimensions: "; |
View quicksort.c
// Quicksort | |
template <typename T> | |
void quicksort(T arr, int l, int r) | |
{ | |
int i, j; | |
i = l; | |
j = r; | |
int middle = arr[(i + j) / 2]; | |
do |
View insertion_sort.c
// Insertion sort | |
for (int i = 0; i < N; i++) | |
{ | |
int j = i; | |
while (j > 0 && array[j] < array[j-1]) | |
{ | |
// Swap array[j] and array[j-1] | |
swap(array[j], array[j-1]); | |
j--; | |
} |
View bubble_sort.c
// Bubble sort | |
for (int i = 0; i < N; i++) | |
{ | |
for (int j = 0; j < N - i; j++) | |
{ | |
if (array[j] > array[j + 1]) | |
{ | |
swap(array[j+1], array[j]); | |
} | |
} |
View GCD_LCM.c
//GCD_LCM | |
int a1 = a, | |
b1 = b; | |
while (b1 != 0) | |
{ | |
a1 %= b1; | |
swap(a1, b1); | |
} | |
View IDEA .gitignore
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm | |
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | |
# User-specific stuff: | |
.idea/**/workspace.xml | |
.idea/**/tasks.xml | |
.idea/dictionaries | |
# Sensitive or high-churn files: | |
.idea/**/dataSources/ |
View OpenWithSublimeText3.bat
@echo off | |
SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe | |
rem add it for all file types | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f | |
rem add it for folders | |
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f |
NewerOlder