This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
# Listゆうに指定した値がいくつか数えたら速くない?ってなってやってみる | |
def bestInvitation(first, second): | |
l = first + second | |
for i in l: | |
if i not in dic: | |
dic.setdefault(i, l.count(i)) | |
return max(dic.values()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*- coding: utf-8 -*- | |
def linear_search(lst, target): | |
for i in lst: | |
if i == target: | |
print ('Find') | |
break | |
else: | |
print ('Not found') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
def insertation_sort(arr): | |
for i in range(1, len(arr)): | |
j = i | |
while(j > 0 and arr[j - 1] > arr[j]): | |
tmp = arr[j - 1] | |
arr[j - 1] = arr[j] | |
arr[j] = tmp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
def bubble_sort(arr): | |
for i in arr: | |
for j in range(len(arr) - 1): | |
if arr[j] > arr [j + 1]: | |
tmp = arr[j] | |
arr[j] = arr[j + 1] | |
arr[j + 1] = tmp | |
return arr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
#テストしたい方を実装 | |
def read_file(): | |
with open('test.txt', mode='r') as f: | |
return f.read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 「複数データのUPSERT」 | |
* 作成者:Kenta Yamada | |
* 作成日:2014/09/09 | |
* DBMS:SQL-Server2008R2 | |
*/ | |
--データベース作成 | |
CREATE TABLE sqlPractice | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-*-coding;utf-8-*- | |
def bubble_sort_asc(array): | |
length = len(array) -1 | |
i = 0 | |
while(i < length): | |
j = i | |
while(j < length): | |
if array[i] > array[j + 1]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
class BubbleSort | |
{ | |
static void Main() | |
{ | |
var array = new List<int>(); | |
var rand = new Random(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Linq; | |
using System.Windows.Forms; | |
public class GenericsDataGridView : DataGridView | |
{ | |
public ExDataGridView() | |
: base() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//複数データを1つのInsert文で発行して実行するプログラムのサンプル | |
//使用DB:SQL-Server208R2 | |
//※1 SQL-Server2008以降でサポートされている構文です。 | |
//※2 Oracleは"Insert all"という構文を使って同様のことを実現することができます。 | |
//※3 PostgreSQL8.2以降でもSQL-Serverと同じ構文で実現できる(らしい) | |
using System; | |
using System.Data.SqlClient; | |
using System.Text; |