Skip to content

Instantly share code, notes, and snippets.

View eroltutumlu's full-sized avatar

Erol TUTUMLU eroltutumlu

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>PDF TASK</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
@eroltutumlu
eroltutumlu / gist:5299a8d4afc3330722d2
Last active March 1, 2023 05:52
Singly linked list // 2
/*
*http://stackoverflow.com/questions/23317646/why-is-strcpy-unsafe-in-c
We can use strncpy instead of strcpy. It's safer.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_SIZE 10
typedef struct teacherData{
@eroltutumlu
eroltutumlu / gist:eeccb358b2d4d73db820
Last active August 29, 2015 14:16
Singly Linked Lists in C
#include <stdio.h>
#include <stdlib.h>
struct listNode{
int id;
char name[10];
struct listNode *nextPtr;
};
typedef struct listNode ListNode;
@eroltutumlu
eroltutumlu / gist:1bdffbd86174de99001a
Created March 4, 2015 21:30
Simple java Collections sample
import java.util.*;
public class Main {
public static void main(String[] args) {
List<String> list1 = new ArrayList<String>();
Scanner scan = new Scanner(System.in);
System.out.println("Bir sayı yazınız : ");
int number = scan.nextInt();
@eroltutumlu
eroltutumlu / gist:a81232e8736d9d3f0655
Created February 28, 2015 11:10
Simple TicTacToe Game | JAVA
package JavaOgreniyorum;
// Main class'ından obje oluşturulup çağırılmalıdır.
import java.util.Scanner;
public class XOXGame {
private final int cSIZE = 3;
private final int rSIZE = 3;
@eroltutumlu
eroltutumlu / gist:0626ee1bff7426efbc9e
Created February 27, 2015 17:39
Java ile sayı tahmin
package JavaOgreniyorum;
import java.util.*;
public class Main {
public static void main(String[] args) {
Random rand = new Random();
final int randomNumber = rand.nextInt(100)+1;
int GuessNumber;
@eroltutumlu
eroltutumlu / gist:88a4e6d08fc02e7ddc7c
Last active August 29, 2015 14:15
Lychrel number
/*
NOT: Algoritma doğru fakat Big Integer sınıfı kullanılmadığı için değer aşımı var .
https://projecteuler.net/problem=55
Eğer 47 sayısını alır ters çevirir ve toplarsak 47+74 = 121 sayısını elde ederiz ki bu sayı palindromik bir sayıdır(sağdan ve soldan yazıldığında aynı).
Fakat her sayı bu kadar kolay palindrom üretmez. Örneğin:
package Sample;
public class Main {
public static void main(String[] args) {
Divide exp = new Divide();
int Sonuc = exp.Divider(10, 5);
@eroltutumlu
eroltutumlu / gist:2997e27bdd505f200b86
Created February 11, 2015 12:58
Öklid Algoritması ile Ebob bulma
#include <stdio.h>
/*
ebob(m, n) = ebob(n, m mod n)
while n != 0
rm mod n
mn
nr
return m
@eroltutumlu
eroltutumlu / gist:d1c1eb66183b996bfaad
Created February 10, 2015 20:48
Sieve of Eratosthenes Algorithm
#include <stdio.h>
#include <stdlib.h>
#define SIZE 1000000
int main(void) {
long long int i,j;
int *primes;
primes = malloc(sizeof(int)*SIZE);