Counting Sort

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#define MAX_VALUE 10001

int n, m;
int a[MAX_VALUE];

int main()
{
    printf("Count : ");
    scanf("%d", &n);
    printf("\r\n\r\n");
    for (int i = 0; i < n; i++) {
        printf("a[%d] : ", i);
        scanf("%d", &m); 
        a[m]++; 
    }
    printf("\r\n\r\n");
    printf("Result :");
    printf("\r\n");
    for (int i = 0; i < MAX_VALUE; i++) {
        while (a[i] != 0) {
            printf("%d ", i);
            a[i]--;
        }
    }

    printf("\r\n\r\n");
    system("pause");
}

 

 

be the happy Gosu.

woojja ))*

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

 

반응형

'ETC > C, C++' 카테고리의 다른 글

[C, C++] Counting Sort  (2) 2022.02.09
[C, C++] Selection Sort, Insertion Sort  (0) 2021.11.04
[C, C++] Queue in Array, Linked List  (0) 2021.10.20
[C, C++] Stack in Array, Lined List  (0) 2021.10.20
[C, C++] Sorted Doubly Linked List  (0) 2021.10.20
  1. Favicon of http://www.sysnet.pe.kr BlogIcon kevin 2022.02.15 15:43

    요즘 C++ 하시나봐요? ^^

이미지 관련 Web Site 가 있어 소개합니다. Web Api 도 있고요.

https://javascript.plainenglish.io/17-killer-websites-for-web-developers-13e1e30345b8

첫번째로 Storytale 입니다.

 

https://storytale.io/

 

Storytale — High-class web illustrations under simple subscription

Huge library of stylish illustrations that grows every week. You can get them all by yearly subscription and download any illustrations you want for commecial and personal projects.

storytale.io

 

두번째로는 Unsplash Source 입니다. 이곳은 Web api 입니다.

 

https://source.unsplash.com/

 

Unsplash Source

A simple API for embedding free high-resolution photos from Unsplash.

source.unsplash.com

 

세번째로는 pfpmaker 입니다.

간단히 프로필 사진을 만들어 보세요.

https://pfpmaker.com/

 

Free Profile Picture Maker - Create an awesome profile pic from any photo

Easily create a perfect profile picture and get 14x times more views & 36x times more chances to receive a message. Upload your photo and instantly get dozens of designs generated with AI

pfpmaker.com

 

행복한 고수되십시오.

woojja ))*

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

반응형

'ETC > Free Resources' 카테고리의 다른 글

[Free Resources] 유용한 Image 관련 Web Sites  (0) 2021.12.14
[Free Resources] Build-your-own-x  (0) 2021.08.23
[Free Resources] Awesome CS Courses  (0) 2021.08.23
import tensorflow as tf
node1 = tf.constant(3.0, tf.float32)
node2 = tf.constant(4.0, tf.float32)
node3 = tf.add(node1, node2)
print("node1 : ", node1, "node2 : ", node2)
print("node3 : ", node3)
node1 :  tf.Tensor(3.0, shape=(), dtype=float32) node2 :  tf.Tensor(4.0, shape=(), dtype=float32)
node3 :  tf.Tensor(7.0, shape=(), dtype=float32)
#tfSession =  tf.session()
#print("tfSession.run(node1, node2) : ", tfSession.run(node1, node2))
#pring("tfSession.run(node3) : ", tfSession.run(node3))

tf.print("node1 : ", node1, ", node2 : ", node2)
tf.print("node3 : ", node3)
node1 :  3 , node2 :  4
node3 :  7
#a = tf.placeholder(tf.float32)
#b = tf.placeholder(tf.float32)
#add_node = a + b

@tf.function
def add_node(a, b):
    return a+b

a = tf.constant(4, tf.float32)
b = tf.constant(3, tf.float32)
print("add_node : ", add_node(a, b))
add_node : tf.Tensor(7.0, shape=(), dtype=float32)

# tf.add: 덧셈
print("tf.add : ", tf.add(2,3))

# tf.subtract: 뺄셈
print("tf.subtract : ", tf.subtract(2,3))

# tf.multiply: 곱셈
print("tf.multiply : ", tf.multiply(2,3))

# tf.divide: 나눗셈
print("tf.divide : ", tf.divide(2,3))

# tf.pow: n-제곱
print("tf.pow : ", tf.pow(2,3))

# tf.negative: 음수 부호
print("tf.negative : ", tf.negative(2))

# tf.abs: 절대값
print("tf.abs : ", tf.abs(-2))

# tf.sign: 부호
print("tf.sign : ", tf.sign(-2))

# tf.round: 반올림
print("tf.round : ", tf.round(1.2))

# tf.math.ceil: 올림
print("tf.ceil : ", tf.math.ceil(1.2))

# tf.floor: 내림
print("tf.floor : ", tf.floor(1.2))

# tf.math.square: 제곱
print("tf.math.square : ", tf.math.square(-2))

# tf.math.sqrt: 제곱근
A = tf.constant(4, tf.float32)
print("tf.math.sqrt : ", tf.math.sqrt(A))

# tf.maximum: 두 텐서의 각 원소에서 최댓값만 반환.
print("tf.maximum : ", tf.maximum(2, 3))

# tf.minimum: 두 텐서의 각 원소에서 최솟값만 반환.
print("tf.minimum : ", tf.minimum(2, 3))

# tf.cumsum: 누적합
x = tf.constant([2, 4, 6, 8])
print("tf.cumsum : ", tf.cumsum(x))

# tf.math.cumprod: 누적곱
x = tf.constant([2, 4, 6, 8])
print("tf.math.cumprod : ", tf.math.cumprod(x))
tf.add :  tf.Tensor(5, shape=(), dtype=int32)
tf.subtract :  tf.Tensor(-1, shape=(), dtype=int32)
tf.multiply :  tf.Tensor(6, shape=(), dtype=int32)
tf.divide :  tf.Tensor(0.6666666666666666, shape=(), dtype=float64)
tf.pow :  tf.Tensor(8, shape=(), dtype=int32)
tf.negative :  tf.Tensor(-2, shape=(), dtype=int32)
tf.abs :  tf.Tensor(2, shape=(), dtype=int32)
tf.sign :  tf.Tensor(-1, shape=(), dtype=int32)
tf.round :  tf.Tensor(1.0, shape=(), dtype=float32)
tf.ceil :  tf.Tensor(2.0, shape=(), dtype=float32)
tf.floor :  tf.Tensor(1.0, shape=(), dtype=float32)
tf.math.square :  tf.Tensor(4, shape=(), dtype=int32)
tf.math.sqrt :  tf.Tensor(2.0, shape=(), dtype=float32)
tf.maximum :  tf.Tensor(3, shape=(), dtype=int32)
tf.minimum :  tf.Tensor(2, shape=(), dtype=int32)
tf.cumsum :  tf.Tensor([ 2  6 12 20], shape=(4,), dtype=int32)
tf.math.cumprod :  tf.Tensor([  2   8  48 384], shape=(4,), dtype=int32)

 

 

be the happy Gosu.

woojja ))*

\\\\\\\\\\\\\\\\\\

 

PS) I wrote this in markdown, but.. ^^;

반응형

'ETC > Tensorflow' 카테고리의 다른 글

[Tensorflow] Session and PlaceHolder in Tensorflow 2.0  (0) 2021.11.08

1. Selection Sort

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <limits.h>

#define SIZE 1000

int a[SIZE];

int swap(int *a, int *b) {
	int temp = *a;
	*a = *b;
	*b = temp;
}

int main(void) {
	int n, min, index;
	scanf("%d", &n);

	for (int i = 0; i < n; i++) scanf("%d", &a[i]);

	for (int i = 0; i < n; i++) {
		min = INT_MAX;
		for (int j = i; j < n; j++) {
			if (min > a[j]) {
				min = a[j];
				index = j;
			}
		}
		swap(&a[i], &a[index]);
	}
	for (int i = 0; i < n; i++) {
		printf("%d", a[i]);
	}
	system("pause");
	return 0;
}

 

2. Insertion Sort

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <limits.h>

#define SIZE 1000

int a[SIZE];

int swap(int *a, int *b) {
	int temp = *a;
	*a = *b;
	*b = temp;
}

int main(void) {
	int n;
	scanf("%d", &n);

	for (int i = 0; i < n; i++) scanf("%d", &a[i]);

	for (int i = 0; i < n - 1; i++) {
		int j = i;
		while (j >= 0 && a[j] > a[j + 1]) {
			swap(&a[j], &a[j + 1]);
			j--;
		}
	}


	for (int i = 0; i < n; i++) {
		printf("%d", a[i]);
	}
	system("pause");
	return 0;
}

 

be the happy Gosu.

woojja ))*

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

반응형

'ETC > C, C++' 카테고리의 다른 글

[C, C++] Counting Sort  (2) 2022.02.09
[C, C++] Selection Sort, Insertion Sort  (0) 2021.11.04
[C, C++] Queue in Array, Linked List  (0) 2021.10.20
[C, C++] Stack in Array, Lined List  (0) 2021.10.20
[C, C++] Sorted Doubly Linked List  (0) 2021.10.20

+ Recent posts