Skip to content

Instantly share code, notes, and snippets.

View rahuladream's full-sized avatar
🏁
Towards Goal

Rahul Singh rahuladream

🏁
Towards Goal
View GitHub Profile
@rahuladream
rahuladream / SmartAssembly.cpp
Last active October 4, 2017 18:37
Set of commands given were: 1. ECHO 1: prints the number. Eg. ECHO 1 prints 1 2. Exit: exits the program. 3. SET a 0: assign variable a value 0. 4. ADD 2 3 z: this means z = 2+3 assign sum of first two values to third one. 5. GOTO and LABEL: works as label and Goto defined in c language but label can be before or after goto 6. IF and END: If IF …
#include<bits/stdc++.h>
using namespace std;
map<string,int>var;
void sett(string s,string ss){
if(var.find(ss) != var.end()){
var[s]=var[ss];
}else if(ss[0]>=48 && ss[0]<=57){
var[s]=stoi(ss);
}else{
var[s]=0;
@rahuladream
rahuladream / bubble_sort.cpp
Created October 9, 2017 20:10
Bubble Sort
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a[6] = {5,1,6,2,3};
int i,j,temp;
for(i=0; i<6; i++)
{
int flag=0;
for(j=0; j<(6-i); j++)
@rahuladream
rahuladream / insertion_sort.cpp
Created October 9, 2017 20:11
Insertion Sort
#include <bits/stdc++.h>
using namespace std;
void insertionSort(int arr[], int length);
void printArray(int array[],int size);
int main()
{
int array[5] = {5,4,3,2,1};
insertionSort(array,5);
@rahuladream
rahuladream / selection_sort.cpp
Created October 9, 2017 20:13
Selection Sort
#include<iostream>
using namespace std;
int main()
{
int i,j,n,loc,temp,min,a[30];
cout<<"Enter the number of elements:";
cin>>n;
cout<<"Enter the element";
@rahuladream
rahuladream / upper_string.cpp
Created October 9, 2017 20:14
Upper String Without using function
#include <bits/stdc++.h>
using namespace std;
char* mystrupr(char *s);
int main()
{
char str[20];
puts("Enter a string");
cin>>str;
mystrupr(str);
cout<<"Upper case is : >> "<<str;
@rahuladream
rahuladream / quick_sort.cpp
Created October 9, 2017 21:49
Quick Sort
#include <bits/stdc++.h>
using namespace std;
void quicksort(int[],int,int);
int partition(int[],int,int);
// Input and Main Function
int main()
{
int a[30],p,n,r;
cout<<"enter the number of element";
cin>>n;
@rahuladream
rahuladream / merge_sort.cpp
Created October 9, 2017 22:47
Merge Sort
#include <bits/stdc++.h>
using namespace std;
void mergesort(int [],int,int);
void merge(int[],int,int,int);
int main()
{
int a[30],p,r,q,n;
cout<<"enter the number of element";
cin>>n;
@rahuladream
rahuladream / stack_implement.cpp
Created October 9, 2017 23:14
Stack Implementation
#include <bits/stdc++.h>
using namespace std;
int max,i,n;
int top=-1;
class stack
{
int s[20];
public:
void push();
@rahuladream
rahuladream / simple_sum_of_array.cpp
Created November 5, 2017 12:57
Sample Input 6 1 2 3 4 10 11 |||| Sample Output 31
#include <bits/stdc++.h>
using namespace std;
int simpleArraySum(int n, vector <int> ar)
{
int sum = 0;
for(int i = 0; i < n ; i++){
sum += ar[i];
}
return(sum);
}
<script src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/mp3recorder.js"></script>
<script type="text/javascript">
var audio_context;
function __log(e, data) {
log.innerHTML += "\n" + e + " " + (data || '');
}