Skip to Content
プログラミング言語AWK 第2版
book

プログラミング言語AWK 第2版

by Alfred V. Aho, Brian W. Kernighan, Peter J. Weinberger, 千住 治郎
May 2024
Intermediate to advanced
276 pages
3h 51m
Japanese
O'Reilly Japan, Inc.
Content preview from プログラミング言語AWK 第2版

8章アルゴリズムの実験

ものの動作を理解する最善の方法は、その縮小版を作成し実験を重ねることだ。この事実は特にアルゴリズムに当てはまる。実際のコードを書くと、疑似コードでは簡単に見過ごしてしまう問題でも浮き彫りにでき、問題点を明らかにできる。さらにこの機能縮小版プログラムは動作確認にも使用できる。動作が想定通りかをテストできるのだ。これは疑似コードではできないことだ。

Awk はアルゴリズムの実験に最適なツールでもある。プログラムを Awk で記述すると、言語の細部に迷うことなくアルゴリズムそのものに集中できる。そのアルゴリズムが大規模プログラムに組み込まれるのであれば、まず単体で動作するプロトタイプを実装すると開発生産性が向上するだろう。小規模な Awk プログラムを複数実装する開発スタイルは、デバッグ、テスト、性能評価の基盤構築に優れた威力を発揮する。この点はアルゴリズムを最終的に実装する言語の種類に依存しない。

本章ではアルゴリズムの実験について述べる。章の前半では、アルゴリズム入門コースによくある一般的なソートアルゴリズムを 3 つ取り上げ、Awk を用いテスト、性能測定、プロファイリングを行う。章の後半では、トポロジカルソートアルゴリズムを複数取り上げ、ファイルを更新する Unix コマンド、make にまで発展させる。

8.1ソート

本節では有名かつ有用なソートアルゴリズム、挿入ソート (insertion sort)、クイックソート (quicksort)、ヒープソート (heapsort) の 3 つを題材に取り上げる。挿入ソートは簡潔だが、効率的に動作するのは要素数が少ない場合に限られる。クイックソートは汎用性が高く、ヒープソートは最悪の場合でも性能が落ちにくい特徴を持つ。上記 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

プログラミングRust 第2版

プログラミングRust 第2版

Jim Blandy, Jason Orendorff, Leonora F. S. Tindall, 中田 秀基
仕事ではじめる機械学習 第2版

仕事ではじめる機械学習 第2版

有賀 康顕, 中山 心太, 西林 孝
詳説 イーサネット 第2版

詳説 イーサネット 第2版

Charles E. Spurgeon, Joann Zimmerman, 三浦 史光, 豊沢 聡
Linuxカーネルプログラミング 第2版

Linuxカーネルプログラミング 第2版

Kaiwan N. Billimoria, 武内 覚, 大岩 尚宏

Publisher Resources

ISBN: 9784814400706Publisher Website