Skip to content

Instantly share code, notes, and snippets.

@ArtyomLazyan
ArtyomLazyan / binarySearch.cpp
Created March 12, 2017 09:43
BINARY SEARCH
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
/**************************** BINARY SEARCH *******************************/
int A[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
int binarySearch(int Arr[], int size, int num)
@ArtyomLazyan
ArtyomLazyan / StrategyPattern.php
Created March 14, 2017 12:32
Strategy Pattern
/************************* Strategy Pattern ************************/
<?php
interface SortStrategy
{
public function sort();
}
class QuickSort
{
@ArtyomLazyan
ArtyomLazyan / AdapterPattern.php
Created March 14, 2017 13:04
Adapter Pattern
************************* Addapter Pattern ************************
<br>* nra hamara vor orinak mi qani tex nuyn funkcian es kanchum mekel mi or uzum es funkciayi *
<br>* anun@ poxes amen mekin@ arandzin arandzin chpoxes ena miangamic erku tex poxum es u verj * <br><br>
<?php
class Facebook
{
public function posting($msg)
{
echo "<br>Posting message...";
@ArtyomLazyan
ArtyomLazyan / bubbleSort.cpp
Last active April 21, 2017 19:25
BubbleSort
/* *************** BUBBLE SORT speed O(n^2) ***************** */
#include <iostream>
int ar[] = { 5, 9, 21, 1, 34, 22, 8, 12, 0, 22, 90, 65 };
int size = sizeof(ar) / sizeof(ar[0]);
void bubbleSort(int arr[])
{
@ArtyomLazyan
ArtyomLazyan / selectionSort.cpp
Last active April 21, 2017 19:18
SelectionSort
/* ************* SELECTION SORT speed O(n^2) *************** */
#include <iostream>
int ar[] = { 5, 9, 21, 1, 34, 22, 8, 12, 0, 22, 90, 65 };
int size = sizeof(ar) / sizeof(ar[0]);
int min = 0;
void selectionSort(int arr[])
{
for (int i = 0; i < size - 1; i++)
/* ******** INSERTION SORT O(n^2) ********* */
#include <iostream>
int ar[] = { 5, 9, 21, 1, 34, 22, 8, 12, 0, 22, 90, 65 };
int size = sizeof(ar) / sizeof(ar[0]);
void insertionSort(int arr[])
{
int j;
@ArtyomLazyan
ArtyomLazyan / ReverseStr.cpp
Created April 22, 2017 19:10
ReverseString
/* ********** REVERSE STRING *********** */
#include <iostream>
int main()
{
char str[] = "Hello world";
int i = 0, j = 0;
@ArtyomLazyan
ArtyomLazyan / cookie.php
Created June 26, 2017 10:02
Work With Cookies
#include <iostream>
#include <cstring>
class MatricFactory
{
public:
int** createArray(int row, int col, int initial = 0)
{
int **arr = new int* [row];
for (int i = 0; i < row; i++)
@ArtyomLazyan
ArtyomLazyan / index.html
Created July 31, 2017 12:19
Facebook Log In
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>FaceBook LogIn</title>
<link rel="stylesheet" href="https://bootswatch.com/flatly/bootstrap.min.css">
<style media="screen">
#fb-btn {
margin-top: 20px;
}