Merge branch 'master' into My-Edit

This commit is contained in:
Jerin Joseph 2018-10-08 23:56:14 +05:30 committed by GitHub
commit 66eb07b417
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 1766 additions and 62 deletions

View File

@ -1,6 +1,8 @@
Fixes or introduces:
:warning: This is a Pull Request Template :warning:
> Checkout all the things you've done by placing an \*x*\ within the square braces.
## Proposed Changes
-
-
- [ ] I've forked the repository.
- [ ] I've created a branch and made my chagnes in it.
- [ ] I've read the [CODE OF CONDUCT](https://github.com/my-first-pr/hacktoberfest-2018/blob/master/CODE_OF_CONDUCT.md) and abide to it.
- [ ] I've read the [CONTRIBUTING.md](https://github.com/my-first-pr/hacktoberfest-2018/blob/master/CONTRIBUTING.md)
- [ ] I understand opening a PULL REQUEST doesn't mean it will be merged for sure.

718
README.md

File diff suppressed because it is too large Load Diff

View File

@ -21,7 +21,7 @@
{% endif %}
<p>{{ site.description | default: site.github.project_tagline }}</p>
<!-- heading to a link -->
<p class="view"><a href="https://my-first-pr.github.io">Homepage</a></p>
<h3>Current projects</h3>
@ -85,4 +85,4 @@ ga('send', 'pageview');
request.send();
</script>
</body>
</html>
</html>

6
akag98.cpp Normal file
View File

@ -0,0 +1,6 @@
#include<iostream>
using namespace std;
int main(){
cout<<"Hello World"<<endl;
}

52
code/Aditya1.c Normal file
View File

@ -0,0 +1,52 @@
#include<stdio.h>
void swap(int* a, int* b)
{
int t = *a;
*a = *b;
*b = t;
}
int partition (int arr[], int low, int high)
{
int pivot = arr[high];
int i = (low - 1);
for (int j = low; j <= high- 1; j++)
{
if (arr[j] <= pivot)
{
i++;
swap(&arr[i], &arr[j]);
}
}
swap(&arr[i + 1], &arr[high]);
return (i + 1);
}
void quickSort(int arr[], int low, int high)
{
if (low < high)
{
int pi = partition(arr, low, high);
quickSort(arr, low, pi - 1);
quickSort(arr, pi + 1, high);
}
}
void printArray(int arr[], int size)
{
int i;
for (i=0; i < size; i++)
printf("%d ", arr[i]);
printf("n");
}
int main()
{
int arr[] = {10, 7, 8, 9, 1, 5};
int n = sizeof(arr)/sizeof(arr[0]);
quickSort(arr, 0, n-1);
printf("Sorted array: n");
printArray(arr, n);
return 0;
}

21
code/Apostropheqq.cpp Normal file
View File

@ -0,0 +1,21 @@
#include <iostream>
using namespace std;
void reverse(const string& a);
int main()
{
string str;
cout << " Please enter a string " << endl;
getline(cin, str);
reverse(str);
return 0;
}
void reverse(const string& str)
{
size_t numOfChars = str.size();
if(numOfChars == 1)
cout << str << endl;
else
{
cout << str[numOfChars - 1];
reverse(str.substr(0, numOfChars - 1));
}

7
code/Ayush-Mahajan.c Normal file
View File

@ -0,0 +1,7 @@
#include<stdio.h>
int main()
{
printf("Hello World");
return 0;
}

9
code/Ayush-Mahajan.cpp Normal file
View File

@ -0,0 +1,9 @@
#include<iostream>
using namespace::std;
int main()
{
cout << "hello world";
return 0;
}

4
code/Exoceus.py Normal file
View File

@ -0,0 +1,4 @@
name = 'Jatin Mehta'
greeting = "Hello World, I am "
print(greeting, name)

View File

@ -0,0 +1 @@
print("Hello, World!")

View File

@ -0,0 +1,9 @@
// LANGUAGE: Java
// AUTHOR: Ana Carolina
// GITHUB: https://github.com/anacdf
public class HelloWorld {
public static void main(String[] args) {
System.out.print("Hello, World");
}
}

1
code/Jaicke.py Normal file
View File

@ -0,0 +1 @@
print("Hello World")

40
code/SuperFola.cpp Normal file
View File

@ -0,0 +1,40 @@
#include <iostream>
#include <time.h>
#include <stdlib.h>
template <class T>
void swapThem(T* a, T* b)
{
T c = *b;
*b = *a;
*a = c;
}
// a strange implementation of the fibonacci algorithm, because why not !
int main(void)
{
using bigint_t = unsigned long long int;
// setting the seed for rand
srand(static_cast<unsigned>(time(0)));
// some variables to store the fibonacci serie
bigint_t a = 1, b = 0;
// find a limit
unsigned c = 0, limit = (rand() % 30) + 10;
while (true)
{
// calculating the fibonacci serie and displaying it
a += b;
std::cout << a << " ";
swapThem(&a, &b);
c++; // so much fun ^^
if (c == limit)
break;
}
std::cout << std::endl;
return 0;
}

3
code/SuperFola.php Normal file
View File

@ -0,0 +1,3 @@
<?php
echo "Hello world !";
?>

14
code/ZornitsaAsanska.hs Normal file
View File

@ -0,0 +1,14 @@
--First steps in Higher Order Functions
divideByTen :: (Floating a) => a -> a
divideByTen = (/10)
divideTenBy :: (Floating a) => a -> a
divideTenBy = (10/)
subtractFour :: (Num a) => a -> a
subtractFour = (subtract 4)
--subtract a b returns b-a
-- subtract :: Num a => a -> a -> a
--subtract a returns (a -> a) - a function that takes one parameter and subtracts the already given one from it

31
code/adhishanand9.cpp Normal file
View File

@ -0,0 +1,31 @@
#include <iostream>
#include <string>
#include<stdio.h>
#include<cstring>
using namespace std;
class GoodString
{
int t;
public:
GoodString(int x)
{
t=x;
}
void newstring(string str)
{
for(int i=0;i<t;i++)
cout<<str.at(i);
}
};
int main ()
{
int n;
cin>>n;
GoodString ob(n);
string str;
getchar();
getline(cin,str);
ob.newstring(str);
return 0;
}

1
code/aka4rKO.boo Normal file
View File

@ -0,0 +1 @@
print "Hello, world!"

53
code/aka4rKO.exe Normal file
View File

@ -0,0 +1,53 @@
// C# implementation of recursive Binary Search
using System;
class GFG
{
// Returns index of x if it is present in
// arr[l..r], else return -1
static int binarySearch(int []arr, int l,
int r, int x)
{
if (r >= l)
{
int mid = l + (r - l)/2;
// If the element is present at the
// middle itself
if (arr[mid] == x)
return mid;
// If element is smaller than mid, then
// it can only be present in left subarray
if (arr[mid] > x)
return binarySearch(arr, l, mid-1, x);
// Else the element can only be present
// in right subarray
return binarySearch(arr, mid+1, r, x);
}
// We reach here when element is not present
// in array
return -1;
}
// Driver method to test above
public static void Main()
{
int []arr = {2, 3, 4, 10, 40};
int n = arr.Length;
int x = 10;
int result = binarySearch(arr, 0, n-1, x);
if (result == -1)
Console.WriteLine("Element not present");
else
Console.WriteLine("Element found at index "
+ result);
}
}
// This code is contributed by Sam007.

48
code/aka4rKO.java Normal file
View File

@ -0,0 +1,48 @@
// Java implementation of recursive Binary Search
class BinarySearch
{
// Returns index of x if it is present in arr[l..
// r], else return -1
int binarySearch(int arr[], int l, int r, int x)
{
if (r>=l)
{
int mid = l + (r - l)/2;
// If the element is present at the
// middle itself
if (arr[mid] == x)
return mid;
// If element is smaller than mid, then
// it can only be present in left subarray
if (arr[mid] > x)
return binarySearch(arr, l, mid-1, x);
// Else the element can only be present
// in right subarray
return binarySearch(arr, mid+1, r, x);
}
// We reach here when element is not present
// in array
return -1;
}
// Driver method to test above
public static void main(String args[])
{
BinarySearch ob = new BinarySearch();
int arr[] = {2,3,4,10,40};
int n = arr.length;
int x = 10;
int result = ob.binarySearch(arr,0,n-1,x);
if (result == -1)
System.out.println("Element not present");
else
System.out.println("Element found at index " +
result);
}
}
/* This code is contributed by Rajat Mishra */

40
code/aka4rKO.py Normal file
View File

@ -0,0 +1,40 @@
# Python Program for recursive binary search.
# Returns index of x in arr if present, else -1
def binarySearch (arr, l, r, x):
# Check base case
if r >= l:
mid = l + (r - l)/2
# If element is present at the middle itself
if arr[mid] == x:
return mid
# If element is smaller than mid, then it
# can only be present in left subarray
elif arr[mid] > x:
return binarySearch(arr, l, mid-1, x)
# Else the element can only be present
# in right subarray
else:
return binarySearch(arr, mid+1, r, x)
else:
# Element is not present in the array
return -1
# Test array
arr = [ 2, 3, 4, 10, 40 ]
x = 10
# Function call
result = binarySearch(arr, 0, len(arr)-1, x)
if result != -1:
print "Element is present at index %d" % result
else:
print "Element is not present in array"

6
code/akag98.cpp Normal file
View File

@ -0,0 +1,6 @@
#include<iostream>
using namespace std;
int main(){
cout<<"Hello World"<<endl;
}

9
code/arshdeep.cpp Normal file
View File

@ -0,0 +1,9 @@
#include<iostream>
using namespace std;
int main(){
cout<<"Hello World"<<endl;
cout<<"This is Arshdeep Singh from India"<<endl;
cout<<"And this is my very first PR"<<endl;
cout<<"Happy Hacktober!!! '18 ";
}

42
code/ashish010598.cpp Normal file
View File

@ -0,0 +1,42 @@
// C program for implementation of Bubble sort
#include <stdio.h>
void swap(int *xp, int *yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
// A function to implement bubble sort
void bubbleSort(int arr[], int n)
{
int i, j;
for (i = 0; i < n-1; i++)
// Last i elements are already in place
for (j = 0; j < n-i-1; j++)
if (arr[j] > arr[j+1])
swap(&arr[j], &arr[j+1]);
}
/* Function to print an array */
void printArray(int arr[], int size)
{
int i;
for (i=0; i < size; i++)
printf("%d ", arr[i]);
printf("n");
}
// Driver program to test above functions
int main()
{
int arr[] = {64, 34, 25, 12, 22, 11, 90};
int n = sizeof(arr)/sizeof(arr[0]);
bubbleSort(arr, n);
printf("Sorted array: \n");
printArray(arr, n);
return 0;
}

14
code/b3g00d.py Normal file
View File

@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
vn_greeting = u"Xin chào!"
en_greeting = "Hello!"
if __name__ == "__main__":
try:
print((">>> print(meaning(\"{}\") == meaning(\"{}\"))").format(
vn_greeting, en_greeting))
except Exception:
print((">>> print(meaning(\"{}\") == meaning(\"{}\"))").format(
vn_greeting.encode("utf-8"), en_greeting))
print(True)

34
code/binary.py Normal file
View File

@ -0,0 +1,34 @@
def binarySearch(arr, l, r, x):
while l <= r:
mid = l + (r - l)//2;
# Check if x is present at mid
if arr[mid] == x:
return mid
# If x is greater, ignore left half
elif arr[mid] < x:
l = mid + 1
# If x is smaller, ignore right half
else:
r = mid - 1
# If we reach here, then the element
# was not present
return -1
# Test array
arr = [ 2, 3, 4, 10, 40 ]
x = 10
# Function call
result = binarySearch(arr, 0, len(arr)-1, x)
if result != -1:
print ("Element is present at index ",result)
else:
print ("Element is not present in array")

1
code/bluetreebranch.js Normal file
View File

@ -0,0 +1 @@
console.log("Hello, world!");

1
code/chadramsey.kt Normal file
View File

@ -0,0 +1 @@
fun main(args : Array<String>) { println("Hello, Hacktoberfest 2018!") }

View File

@ -0,0 +1,188 @@
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<cfloat>
#include<ctime>
using namespace std;
float xfirstx;
float yfirsty;
float xsecondx;
float ysecondy;
class mymath{
public:
float mysqrt(const float x){
const double prec=0.00001;
float low,high,anstry;
if (x < 1){
low = x;
high = 1;
}
else{
low = 1;
high = x;
}
while ((high-low) > prec){
anstry = (low+high)/2;
if(anstry*anstry>x)
high=anstry;
else
low=anstry;
}
return (low + high)/2;
}
};
class points{
float x;
float y;
public:
float showx(){
return x;
}
float showy(){
return y;
}
void setx(float in){
x=in;
}
void sety(float in){
y=in;
}
int xpartition(points arr[],int p,int q){
int k=p;
for(int i=p+1;i<=q;i++){
if(arr[i].showx()<arr[p].showx()){
k++;
points temp=arr[k];
arr[k]=arr[i];
arr[i]=temp;
}
}
points temp=arr[p];
arr[p]=arr[k];
arr[k]=temp;
return k;
}
int ypartition(points arr[],int p,int q){
int k=p;
for(int i=p+1;i<=q;i++){
if(arr[i].showy()<arr[p].showy()){
k++;
points temp=arr[k];
arr[k]=arr[i];
arr[i]=temp;
}
}
points temp=arr[p];
arr[p]=arr[k];
arr[k]=temp;
return k;
}
void xquicksort(points arr[],int p,int q){
if(p<q){
int k=xpartition(arr,p,q);
xquicksort(arr,p,k-1);
xquicksort(arr,k+1,q);
}
}
void yquicksort(points arr[],int p,int q){
if(p<q){
int k=ypartition(arr,p,q);
yquicksort(arr,p,k-1);
yquicksort(arr,k+1,q);
}
}
float absolutevalue(float x){
if(x<0) return -x;
else return x;
}
float dist(points a, points b){
mymath callobj;
return callobj.mysqrt(((a.showx()-b.showx())*(a.showx()-b.showx())+(a.showy()-b.showy())*(a.showy()-b.showy())));
}
float findinstrip(points strip[],float del,int length){
float mind=del;
int j;
for(int i=0;i<length;i++){
for(int j=i+1;j<length && strip[j].showy()-strip[i].showy()<mind;j++){
if(strip[0].dist(strip[i],strip[j])<mind){
mind=strip[0].dist(strip[i],strip[j]);
xfirstx=strip[i].showx();
yfirsty=strip[i].showy();
xsecondx=strip[j].showx();
ysecondy=strip[j].showy();
}
}
}
return mind;
}
float findclosestpair(points xsorted[],points ysorted[], int n){
if(n<=5){
static float d=FLT_MAX;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(xsorted[0].dist(xsorted[i],xsorted[j])<d){
d=xsorted[0].dist(xsorted[i],xsorted[j]);
xfirstx=xsorted[i].showx();
yfirsty=xsorted[i].showy();
xsecondx=xsorted[j].showx();
ysecondy=xsorted[j].showy();
}
}
}
return d;
}
else{
int mid=n/2;
float xmid=xsorted[mid].showx();
points yl[mid+1],yr[n-mid-1];
int ylpos=0,yrpos=0;
for(int i=0;i<n;i++){
if(ysorted[i].showx()<=xmid){
yl[ylpos]=ysorted[i];
ylpos++;
}
else{
yr[yrpos]=ysorted[i];
yrpos++;
}
}
float lmin=findclosestpair(xsorted,yl,mid+1);
float rmin=findclosestpair(xsorted+mid+1,yr,n-mid-1);
float del=min(lmin,rmin);
int ypos=0;
points ystrip[n];
for(int i=0;i<n;i++){
if(xsorted[0].absolutevalue(ysorted[i].showx()-xmid)<del){
ystrip[ypos]=ysorted[i];
ypos++;
}
}
if(del<findinstrip(ystrip,del,ypos)) return del;
else return findinstrip(ystrip,del,ypos);
}
}
};
int main(){
int n;
points callingobject;
cout<<"Give the number of points : ";
cin>>n;
points input[n],xsorted[n],ysorted[n];
// srand(time(NULL));
for(int i=0;i<n;i++){
input[i].setx(((float)(rand())/(float)(RAND_MAX))*(100));
input[i].sety(((float)(rand())/(float)(RAND_MAX))*(100));
xsorted[i]=input[i];
ysorted[i]=input[i];
}
int time1=clock();
callingobject.xquicksort(xsorted,0,n-1);
callingobject.yquicksort(ysorted,0,n-1);
float distance=callingobject.findclosestpair(xsorted,ysorted,n);
int time2=clock();
cout<<"The closest pair of points are ("<<xfirstx<<","<<yfirsty<<") and ("<<xsecondx<<","<<ysecondy<<")."<<endl;
cout<<"The distance between them is "<<distance<<"."<<endl;
cout<<"The time taken for the computation is "<<(time2-time1)<<" microseconds"<<endl;
return 0;
}

View File

@ -0,0 +1 @@
print("i am enjoying hactoberfest :)")

1
code/deepasha Normal file
View File

@ -0,0 +1 @@
printf("hello world");

2
code/diego.js Normal file
View File

@ -0,0 +1,2 @@
console.log("Hello I'm Diego!");
console.log("http://diegomax.info");

18
code/dulcetti.js Normal file
View File

@ -0,0 +1,18 @@
class Beer {
constructor(name = 'Dulcetti', beerName = 'Karmeliet') {
this.name = name;
this.beerName = beerName;
}
sayHello() {
console.info(`Hello, ${ this.name }. Do you wanna a ${ this.beerName }?`)
}
}
// Hello with modified infos
const myInfos = new Beer('Bruno', 'Duvel');
myInfos.sayHello();
// Hello with default infos
const defaultBeer = new Beer();
defaultBeer.sayHello();

7
code/ftabaro/Cargo.toml Normal file
View File

@ -0,0 +1,7 @@
[package]
name = "ftabaro"
version = "0.1.0"
authors = ["ftabaro <francesco.tabaro@gmail.com>"]
[dependencies]
rand = "0.5.5"

26
code/ftabaro/src/main.rs Normal file
View File

@ -0,0 +1,26 @@
extern crate rand;
use rand::prelude::*;
fn main() {
let mut obv = 0;
let mut rev = 0;
let mut i = 0;
while i < 10 {
if random() {
obv += 1;
} else {
rev += 1;
}
i += 1;
}
if obv > rev {
println!("Obverse wins!")
} else {
println!("Reverse wins!")
}
println!("Get info about coin history at https://en.wikipedia.org/wiki/Obverse_and_reverse")
}

22
code/hacktober.go Normal file
View File

@ -0,0 +1,22 @@
package main
import (
"fmt"
"time"
"encoding/json"
)
type Hacktober struct {
Message string `json:"msg"`
Date time.Time `json:"date"`
}
func main () {
data := Hacktober{
Message: "Hello Hacktoberfest 2018!",
Date: time.Now(),
}
jsonBytes, _ := json.MarshalIndent(data, "", " ")
fmt.Println(string(jsonBytes))
}

View File

@ -3,6 +3,7 @@
<body>
Hello, world! </br>
Hello, HacktoberFest!</br></br>
Welcome!!!
<a href="aboutMe.html">About me</a>
</body>
</html>

4
code/howdy.cs Normal file
View File

@ -0,0 +1,4 @@
using System;
Console.WriteLine("Hello there!");
Console.WriteLine("Nice to meet you. Greetings from Bulgaria!");

22
code/ishitavarshney.cpp Normal file
View File

@ -0,0 +1,22 @@
#include <iostream>
using namespace std;
int main()
{
long a,rev,b;
cout<<"\nenter the number :";
cin>>a;
b=a;
rev=0;
while(b)
{
rev=(rev*10)+(b%10);
b=b/10;
}
if(a==rev)
cout<<"\n the number IS a palindrome.";
else
cout<<"\n the number IS NOT a palindrome.";
return 0;
}

8
code/javava.java Normal file
View File

@ -0,0 +1,8 @@
public class MyFirstApp {
public static void main (String[] args) {
System.out.print("Я управляю ");
System.out.println("миром!");
}
}

62
code/kathylambert.html Normal file
View File

@ -0,0 +1,62 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Kathy Lambert Hacktoberfest 2018 Profile</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<link href="https://use.fontawesome.com/releases/v5.0.6/css/all.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet">
</head>
<body>
<h1>Kathy Lambert</h1>
<h3>Software Developer | Project Manager | Web Designer </h3>
<ul>
<li>I am an intellectually curious individual with an insatiable desire to understand.</li>
<li>I utilize my diverse background, experiences, and skills to help me be resourceful, organized and forward-thinking.</li>
<li>I am actively looking for my first developer position post graduation from General Assembly's bootcamp.</li>
<li>I ❤️ making the world beautiful one line of code at a time.</li>
</ul>
<p>Get to know me better =>
<a href="https://kathylambert.me">
<i class="fas fa-laptop" style="color: #00B8CB"></i>
</a>
<a href="https://github.com/Kathy145">
<i class="icon fab fa-github" style="color: #00B8CB"></i>
</a>
<a href="https://www.linkedin.com/in/k-lambert/">
<i class="icon fab fa-linkedin" style="color: #00B8CB"></i>
</a>
<a href="https://www.freecodecamp.org/kathy145">
<i class="icon fab fa-free-code-camp" style="color: #00B8CB"></i>
</a>
</p>
<!-- <script src="" async defer></script> -->
</body>
<style>
:root {
--main-font: 'Raleway', Helvetica, sans-serif;
}
h1, h3, ul, p {
font-family: var(--main-font)
}
a {
text-decoration: none;
}
</style>
</html>

41
code/laksh-ayy.html Normal file
View File

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="Capstone_s.css">
<title>Landing Page</title>
</head>
<body>
<div class="anon">
<h1>Welcome to the Landing Page!!</h1>
<h2>We're a start up that does something</h2>
<br>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<br>
<br>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<br>
<br>
<h2>Sign Up for an upcoming project!</h2>
<form>
<center>
<label for="first">First Name</label>
<br>
<input id="first" type="text" name="first" placeholder="Lakshay" required>
<br>
<label for="last">Last Name</label>
<br>
<input id="last" type="text" name="last" placeholder="Khurana" required>
<br>
<label for="email">Email</label>
<br>
<input id="email" type="email" name="email" placeholder="apnaemail@domain.com" required>
<br>
<br>
<input type="submit" value="Sign Up">
<br>
</center>
</form>
</div>
</body>
</html>

53
code/linear_regression.py Normal file
View File

@ -0,0 +1,53 @@
import numpy as np
import matplotlib.pyplot as plt
def estimate_coef(x, y):
# number of observations/points
n = np.size(x)
# mean of x and y vector
m_x, m_y = np.mean(x), np.mean(y)
# calculating cross-deviation and deviation about x
SS_xy = np.sum(y*x - n*m_y*m_x)
SS_xx = np.sum(x*x - n*m_x*m_x)
# calculating regression coefficients
b_1 = SS_xy / SS_xx
b_0 = m_y - b_1*m_x
return(b_0, b_1)
def plot_regression_line(x, y, b):
# plotting the actual points as scatter plot
plt.scatter(x, y, color = "m",
marker = "o", s = 30)
# predicted response vector
y_pred = b[0] + b[1]*x
# plotting the regression line
plt.plot(x, y_pred, color = "g")
# putting labels
plt.xlabel('x')
plt.ylabel('y')
# function to show plot
plt.show()
def main():
# observations
x = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
y = np.array([1, 3, 2, 5, 7, 8, 8, 9, 10, 12])
# estimating coefficients
b = estimate_coef(x, y)
print("Estimated coefficients:\nb_0 = {} \\nb_1 = {}".format(b[0], b[1]))
# plotting regression line
plot_regression_line(x, y, b)
if __name__ == "__main__":
main()

4
code/lokesh.purs Normal file
View File

@ -0,0 +1,4 @@
import Prelude
import Effect.Console (log)
main = log("Hello World!")

60
code/mergeSort.cpp Normal file
View File

@ -0,0 +1,60 @@
#include<bits/stdc++.h>
using namespace std ;
void merge(int arr[], int l, int m , int r){
int n1 = m-l+1;
int n2 = r-m ;
int L[n1];
int R[n2];
for (int i = 0; i < n1; i++)
L[i] = arr[l + i];
for (int j = 0; j < n2; j++)
R[j] = arr[m + 1+ j];
int i =0, j= 0 , k=l ;
while(i<n1 && j<n2){
if(L[i]<R[j]){
arr[k]= L[i];
i++;
}
else{
arr[k]= R[j];
j++;
}
k++;
}
while(i<n1){
arr[k] = L[i];
i++;k++;
}
while(j<n2){
arr[k]= R[j];
j++;k++;
}
}
void mergeSort(int arr[], int l, int r){
if(l<r){
int m = l+ (r-l)/2 ;
mergeSort(arr,l, m);
mergeSort(arr,m+1,r);
merge(arr, l,m,r);
}
}
void printArray(int A[], int size)
{
int i;
for (i=0; i < size; i++)
printf("%d ", A[i]);
printf("\n");
}
int main() {
int arr[]= {7,5,11,13,6,12};
printArray(arr,6);
mergeSort(arr,0,5);
printArray(arr, 6);
return 0;
}

5
code/mudspringhiker.md Normal file
View File

@ -0,0 +1,5 @@
---
title: Hello
date: 2018-10-07
---
### Hello world!

3
code/ppbra.py Normal file
View File

@ -0,0 +1,3 @@
##
print('Hello, world!')
##

15
code/prvkrFibonacci.cpp Normal file
View File

@ -0,0 +1,15 @@
#include <iostream>
using namespace std;
int main() {
int n1 = 0, n2 = 1, n3, num;
cout << "Enter the number of elements: ";
cin >> num;
cout << n1 << " " << n2 << " ";
for(int i = 2; i < num; ++i){
n3 = n1 + n2;
cout << n3 << " ";
n1 = n2;
n2 = n3;
}
return 0;
}

1
code/prvkrHelloWorld.py Normal file
View File

@ -0,0 +1 @@
print("Hello, World!) # This will print "Hello, World!" on the screen.

23
code/sadikkuzu.py Normal file
View File

@ -0,0 +1,23 @@
## https://gist.github.com/sadikkuzu/af6a69d73f463b1b6b30aec15935dbc9
# https://www.wikiwand.com/en/Happy_number
# http://mathworld.wolfram.com/HappyNumber.html
def square(x):
return int(x) * int(x)
def happy(number):
return sum(map(square, list(str(number))))
def is_happy(number):
seen_numbers = set()
while number > 1 and (number not in seen_numbers):
seen_numbers.add(number)
number = happy(number)
return number == 1
def is_happy2(n): # recursive
return (n == 1 or n > 4 and is_happy2(happy(n)))

1
code/saisandhya3198.py Normal file
View File

@ -0,0 +1 @@
print("Hello World!")

3
code/tormjens.php Normal file
View File

@ -0,0 +1,3 @@
<?php
echo 'Hello World';

14
code/try_except.py Normal file
View File

@ -0,0 +1,14 @@
while True:
line = input()
if line:
try:
a = int(line)
print("Correct!")
exit(0)
except ValueError as vr:
print("Value Error:",vr)
continue
else:
print("Enter something")
continue

View File

@ -0,0 +1,4 @@
program Hello;
begin
writeln ('Hello, world.');
end.

View File

@ -0,0 +1,11 @@
num1 = 10
num2 = 14
num3 = 12
if (num1 >= num2) and (num1 >= num3):
largest = num1
elif (num2 >= num1) and (num2 >= num3):
largest = num2
else:
largest = num3
print("The largest number between",num1,",",num2,"and",num3,"is",largest)

13
code/vakeeshanvictor.pal Normal file
View File

@ -0,0 +1,13 @@
Program Lesson1_Program3;
Var
Num1, Num2, Sum : Integer;
Begin {no semicolon}
Write('Input number 1:');
Readln(Num1);
Writeln('Input number 2:');
Readln(Num2);
Sum := Num1 + Num2; {addition}
Writeln(Sum);
Readln;
End.

12
code/vakeeshanvictor.php Normal file
View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<body>
<h1>My first PHP page</h1>
<?php
echo "Hello World!";
?>
</body>
</html>

22
code/vakeeshanvictor.py Normal file
View File

@ -0,0 +1,22 @@
import datetime
now = datetime.datetime.now()
print "-" * 25
print now
print now.year
print now.month
print now.day
print now.hour
print now.minute
print now.second
print "-" * 25
print "1 week ago was it: ", now - datetime.timedelta(weeks=1)
print "100 days ago was: ", now - datetime.timedelta(days=100)
print "1 week from now is it: ", now + datetime.timedelta(weeks=1)
print "In 1000 days from now is it: ", now + datetime.timedelta(days=1000)
print "-" * 25
birthday = datetime.datetime(2012,11,04)
print "Birthday in ... ", birthday - now
print "-" * 25