Moyazine

日々の学習と生活の記録

Ruby

AIと行くIT世界の旅 #30: ユークリッド互除法

昔受けたコーディング試験で公約数を求める試験を出された気がする。 それが解けなくて足切りされた苦い思い出。 もし仮にこの方法を知ってたら通過できたのかなとかぼんやり思いながら学んだ。 1. Please explain Euclidean algorithm in a way that even e…

AIと行くIT世界の旅 #29: k-means法

クラスタリングってなんか格好いい。 1. Please explain k-means in a way that even elementary school students can understand. 2. What is the time complexity of this algorithm? k-means 3. Please visually explain k-means 4. Explain applications…

AIと行くIT世界の旅 #27: A* アルゴリズム

1. Please explain A* algorithm in a way that even elementary school students can understand. 2. Explain how A* algorithm works 3. What is the time complexity of this algorithm? 4. Please visually explain A* 5. Explain applications and use …

ChatGPTと行くIT世界の旅 #26: ダイクストラ法

今日の記録。 1. Please explain Dijkstra's algorithm in a way that even elementary school students can understand. 2. Explain how Dijkstra's algorithm works 3. What is the time complexity of this algorithm? Dijkstra's algorithm 4. Please vi…

AIと行くIT世界の旅 #25: ベルマン-フォード法

1. Please explain Bellman-Ford algorithm in a way that even elementary school students can understand. 2. Explain how Bellman-Ford algorithm works 3. What is the time complexity of this algorithm? Bellman-Ford algorithm 4. Please visually …

AIと行くIT世界の旅 #24: 深さ優先探索/DFS

Please explain DFS in a way that even elementary school students can understand. Explain how DFS works What is the time complexity of this algorithm? DFS Please visually explain DFS Please explain Ruby implementation DFS このコードをリファ…

AIと行くIT世界の旅 #23: 幅優先探索

Please explain BFS in a way that even elementary school students can understand. Algorithm explanation: "Explain how BFS works” Time complexity: "What is the time complexity of this algorithm? BFS Please visually explain graph theory. Plea…

AIと行くIT世界の旅 #22: グラフ理論

最近は生成データも長くなって疲れるし焦点がボヤける気がした。 だからちょっと今回は軽めに聞いてみることにする。 Please explain graph theory in a way that even elementary school students can understand. Please visually explain graph theory. P…

AIと行くIT世界の旅 #21: 二分探索

二分探索について 0. 二分探索を小学生でもわかりやすく説明してみて 1. はじめに 1.1 二分探索の概要 1.2 二分探索の歴史と背景 2. 二分探索の基本概念 2.1 二分探索とは 2.2 アルゴリズムの手順 2.3 時間計算量 2.4 Rubyでの実装 2.5 図や表で視覚的に理解…

AIと行くIT世界の旅 #20: 線形探索アルゴリズム

線形探索アルゴリズムについて 1. はじめに 1.1 線形探索とは 1.2 背景と歴史 2. 主要な概念 2.1 線形探索の定義 2.2 アルゴリズムの手順 2.3 時間複雑度 2.4 Rubyによる実装 2.5 視覚的な説明 3. 分析と応用 3.1 線形探索の長所と短所 3.2 使用例と応用 3.3…

ChatGPTと行くIT世界の旅 #18: クイックソート

クイックソートアルゴリズムについて はじめに クイックソートとは アルゴリズムのステップ 時間計算量 Rubyによる実装 クイックソートの特徴 まとめ コードをリファクタリングしたい リファクタリング後のコードについて解説して less << element について…

ChatGPTと行くIT世界の旅 #17: マージソート

ChatGPTと対話しながらIT技術を学ぶ。 第17回はマージソートについて。 はじめに マージソートとは アルゴリズム手順 時間計算量 Rubyでの実装 まとめ 質疑応答 Lint Style/FrozenStringLiteralComment: Missing frozen string literal comment.RuboCop(Styl…

ChatGPTと行くIT世界の旅 #16: Rubyにおける標準入力

ChatGPTと会話しながらIT技術をサクッと学ぶシリーズ16回目。今回は標準入力について。 はじめに 標準入力とは gets ARGV IO 結論 疑問点 gets, argv, ioの使い分けについて詳しく gets ARGV IO IOメソッドについて教えて getsを使った例 readを使った例 rea…

ChatGPTと行くIT世界の旅 #15: 変数と定数の違いからRailsのGemと定数管理まで

ちょっとしたコードを書いていた 変数と定数の使い分けについて教えて Railsの場合、定数はどのように切り出す? モデル内で定義: モジュールで定義: config/application.rb や config/environments/*.rb で定義: Rails7でも同じ?定数管理の話。 開発環境、…

ChatGPTと行くIT世界の旅 #14: ヒープソート

はじめに ヒープソートとは アルゴリズムの手順 時間計算量 Rubyによる実装 まとめ 解説 疑問点 Lint Style/SymbolProc: Pass &:to_i as an argument to map instead of a block.R Metrics/AbcSize: Assignment Branch Condition size for heapify is too hi…

ChatGPTと行くIT世界の旅: データ構造 #13 挿入ソート

はじめに 挿入ソートとは アルゴリズムの手順 時間計算量 Rubyでの実装 配列が[33, 43, 2, 55, 9999]の場合で説明してみて (1...n)だからn-1回ループでいいんだよね はじめに 挿入ソートは、シンプルで分かりやすいアルゴリズムです。 この記事では、挿入ソ…

ChatGPTと行くIT世界の旅 #12: 選択ソート

Introduction: What is Selection Sort? Algorithm Steps Time Complexity Ruby Implementation Conclusion: Prompt My Question Q1. time complexity を時間計算量と時間複雑度のどっちで訳す? Q2. (i + 1...n).each do |j| and (i + 1..n).each do |j| In…

【ChatGPTと行くITの旅】#11 Ruby 3.2.1 インストール時のエラー解決: libyaml の導入

Ruby 3.2.1をインストールすることにした rbenvのリストから選択 エラー ChatGPT検証 プロンプト 結果 そもそも 標準添付ライブラリの互換性に関する変更 3rd パーティライブラリのソースコード同梱廃止 Ruby 3.2.1をインストールすることにした どこかでRub…

ChatGPTと行くInformation Technologyの旅 #10 Bubble Sort

Introduction: Bubble Sort is a simple, yet inefficient, sorting algorithm that compares adjacent elements in a list and swaps them if they are in the wrong order. This process is repeated until the list is sorted. In this blog post, we wil…

ChatGPTと行くインフォメーションテクノロジーの旅 #9 ハッシュテーブル

Introduction: Overview of Heap Data Structures: Use Cases for Heap Data Structures: Code Example 解説 Q1. shift_upメソッドの解説 Q2. 配列要素の入れ替え Q3. どのような原理で入れ替えている Q4. @heapの@はどういう意味? Q5. @heapとheapは何が違…

ChatGPTと行くインフォメーションテクノロジーの旅 #8 本のタイトルと章数からディレクトリとMarkdownファイルを生成するzshスクリプト

を書いた。ChatGPTが。 目的とか 先日読んだt_wadaさんのように読書記録をリポジトリ管理したかった。 だが、いちいちmkdirしてtouchしてって工程が面倒臭かったので、楽がしたかった。 なんとなく出来そうだけど、具体的なコードが思いつかなかったのでChat…

ChatGPTと行くインフォメーションテクノロジーの旅 #7 ハッシュテーブル

しれっとタイトルと言語設定を変える。 例の如くChatGPTに聞いてみたら Journey into the World of Programming: Exploration of Computer Science and Software Engineering といういい感じのタイトルがサジェストされたので。副題は長いからいいかなと。 …

ChatGPTと行くインフォメーションテクノロジーの旅 #6 Data Structures Pt.4 Tree

Summary A tree is a hierarchical data structure made up of nodes connected by edges, with the root node at the top and child nodes below. Nodes with the same parent are called siblings. Trees can have zero or more child nodes, and each chi…

ChatGPTと行くインフォメーションテクノロジーの旅 #5 Data Structures Pt.3 Stack and Queue

Sammary This text provides an overview of two common data structures used in computer programming: stack and queue. コンピューター プログラミングで使用される 2 つの一般的なデータ構造であるスタックとキューの概要を説明します A stack stores e…

ChatGPTと行くインフォメーションテクノロジーの旅 #4 Data Structures Pt.2 Linked List

続いた。 Linked List in a nutshell. 連結リストについて完結に説明して A linked list is a data structure that stores a collection of elements where each element, called a node, points to the next element in the list using a pointer. It consi…

ChatGPTと行くインフォメーションテクノロジーの旅 #3 Data Structures Pt.1 Array

This guy changes what he says so easily. こいつすぐ言ってること変わるな。 I crammed it in because I wanted to learn both English and Programming. 英語もプログラミングも勉強したいから詰め込んでみた。 I asked ChatGPT about the array. ChatGPT…

ChatGPTと行くインフォメーションテクノロジーの旅 #2 ゴゴゴッ!ChatGPTからのコーディング問題でプログラミング力を鍛える!

また遊んでみた。 ChatGPTからコード問題を出してもらうことをブログの題材にしたい。いいタイトルない? 以下のようなタイトルが考えられます。 「ChatGPTによるコーディング問題が学びを加速させる!」 「ChatGPTが提供するコーディング問題でプログラミン…

ChatGPTと行くインフォメーションテクノロジーの旅 #1 データ構造 Pt.1

新企画。 コンセプト 毎日のアウトプット ソフトウェアエンジニアとしてサヴァイブするのが目的。200%自分のため。 ChatGPTで遊びたい! 職場じゃ使えないし。 なるべく手軽でサクッと。 継続優先。継続が一番難しい。簡単でもいい。でも学びのある内容で。 …