Skip to content

Instantly share code, notes, and snippets.

@muhammedeminoglu
muhammedeminoglu / prims.c
Last active November 30, 2021 18:32
Prims Algorithm C Code Implemantation. Dont Forget to create matris.txt file
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define MELKOR 1000000
/*
Create matris.txt file in your project folder and copy below content.
0 2 0 6 0
2 0 3 8 5
0 3 0 0 7
@muhammedeminoglu
muhammedeminoglu / dfs.c
Created June 4, 2017 10:48
DFS C Code implementation. This code has been written recursive method. Don't forget matris.txt file. You can change it as you want.
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int Array[6][6];
bool visited[6];
void DFS(int root, bool visited[])
{
int i;
@muhammedeminoglu
muhammedeminoglu / bfs.c
Last active May 25, 2020 16:47
BFS Algorithm C Code with Queue implementation. You have to have "matris.txt" file for nodes. Don't miss it.
#include <stdio.h>
#include <stdbool.h>
int graph[6][6];
bool visited[5];
struct node{
int data;
struct node *next;
};
@muhammedeminoglu
muhammedeminoglu / insertionSort.c
Created May 26, 2017 19:38
Insertion Sort C Code with an Array
#include <stdio.h>
#define SIZE 10000
int myArray[SIZE - 1];
void insertionSort(int x[])
{
int i, j;
int key;
@muhammedeminoglu
muhammedeminoglu / selectionLinked.c
Created May 26, 2017 19:16
Selection Sort on Linked Lists
#include <stdio.h>
#include <stdlib.h>
struct node{
int data;
struct node *next;
};
struct node* start = NULL;
@muhammedeminoglu
muhammedeminoglu / selectionSort.c
Created May 26, 2017 19:01
Selection Sort C Code. I think it is clean and understandable...
#include <stdio.h>
#define SIZE 10000
int myArray[SIZE - 1];
void selectionSort(int x[])
{
int i, j;
int key;
@muhammedeminoglu
muhammedeminoglu / bubbleLinked.c
Created May 20, 2017 23:27
This code shows you how to use linked list on bubble sort.
#include <stdio.h>
#include <stdlib.h>
struct node{
int data;
struct node *next;
};
struct node* start = NULL;
@muhammedeminoglu
muhammedeminoglu / bubbleSort.c
Last active December 2, 2022 17:20
this code generates 10000 random numbers and sorts them with Bubble Sort Algorithm. I used an Array Here. This code could be optimized for if array has already sorted. But my point is just show simple algorithm
#include <stdio.h>
#define SIZE 10000
int myArray[SIZE - 1];
void bubbleSort(int x[])
{
int i, j;
for(i = 1; i < SIZE; i++)
@muhammedeminoglu
muhammedeminoglu / priorityQueue.c
Last active January 2, 2022 11:50
Priority Queue implementation. I used singly Linked list here.
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
struct node{
char name[20];
char secondName[20];
int age;
int priority;
struct node *next;
@muhammedeminoglu
muhammedeminoglu / queueLinked.c
Created May 20, 2017 19:12
Queue implementatih on with Linked Lists
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
struct node{
char name[20];
char secondName[20];
int age;
struct node *next;
};