sorting
bubble sort
selection sort
insertion sort
shell sort
heap sort
merge sort
quick sort
A tool for solving a well-specified computation problem.
A sequence of computation steps that transform the input into the
output.
Process or rule calculation
When talk about algorithms, we shall mostly be thinking in terms of
computers.
Other systematic methods for solving problems could be include.
For example
The methods we learn at school for multiplying and dividing
integers are also algorithms.
Finding a difference algorithm for multiplying an integer.
PINNAREE KUREERUNG INFORMATICS
Sorting problem
Input : a sequence of n numbers < a1, a2,…, an >
Output : a reordering < a′1, a′2, …, a′n > of the input sequence
such that a′1 ≤ a′2 ≤ … ≤ a′n
Ex
An instances of the sorting problem
< 31, 41, 59, 26, 41, 58, 23>
Result
< 23, 26, 31, 41, 41, 58, 59 >
An algorithms is correct if, for every input instance, it halts with
the correct output.
The Efficiency of Algorithms
When we have a problem to solve, it is obviously of interest to find
several algorithms the might be used.
We can choose the BEST.
The empirical approach consists of programming the competing
algorithms and trying them on difference instances with the help of a
computer.
The theoretical approach consists of determining mathematically the
quantity of resources need by each algorithm as a function of the
size of an instances considered.
Execution time
Memory space
Some Practical Examples
Sorting
Required to arrange in ascending order a collection of n objects
on which a total ordering is defined.
Classic sorting algorithm are insertion sorting and selection
sorting.
Calculating the Fibonacci sequence
The Fibonacci sequence is defined by
การเรียงลำดับเรียงลำดับแบบฟองเรียงลำดับแบบเลือกเรียงลำดับแบบแทรกเปลือกเรียงกองเรียงลำดับ เรียงเวียนเรียงลำดับอย่างรวดเร็วเครื่องมือสำหรับการแก้ปัญหาในการคำนวณที่ระบุห้องพัก A ลำดับขั้นตอนการคำนวณที่ป้อนลงในแปลงผลผลิตกระบวนการหรือกฎการคำนวณเมื่อพูดคุยเกี่ยวกับอัลกอริทึม เราจะส่วนใหญ่จะคิดในแง่ของคอมพิวเตอร์วิธีระบบอื่น ๆ สำหรับการแก้ปัญหาอาจรวมตัวอย่างวิธีการเราเรียนที่โรงเรียนสำหรับการคูณ และการหารจำนวนเต็มยังมีอัลกอริทึมการหาอัลกอริทึมความแตกต่างการคูณจำนวนเต็มสารสนเทศ KUREERUNG PINNAREEเรียงลำดับปัญหาป้อน: ลำดับของตัวเลข n < a1, a2,..., มี >ผลผลิต: การสั่งซื้อใหม่ < a′1, a′2,..., a′n > ลำดับการป้อนข้อมูลที่ a′1 ≤ a′2 ≤... ≤ a′nอดีตที่อินสแตนซ์ของปัญหาเรียงลำดับ< 31, 41, 59, 26, 41, 58, 23 >ผล< 23, 26, 31, 41, 41, 58, 59 >อัลกอริทึมถูกต้องถ้า สำหรับทุก ๆ อินสแตนซ์สำหรับการป้อนค่า จะหยุดด้วยผลผลิตถูกต้องประสิทธิภาพของอัลกอริทึมเมื่อเรามีปัญหาแก้ จึงเห็นได้ชัดน่าสนใจในการค้นหาอัลกอริทึมต่าง ๆ อาจใช้ได้เราสามารถเลือกดีที่สุดวิธีรวมประกอบด้วยการแข่งขันการเขียนโปรแกรมอัลกอริทึมและพยายามให้กับอินสแตนซ์ โดยใช้ความแตกต่างคอมพิวเตอร์ประกอบด้วยกำหนด mathematically วิธีทฤษฎีปริมาณของทรัพยากรที่จำเป็น โดยแต่ละอัลกอริทึมเป็นฟังก์ชันของการsize of an instances considered. Execution time Memory spaceSome Practical Examples Sorting Required to arrange in ascending order a collection of n objectson which a total ordering is defined. Classic sorting algorithm are insertion sorting and selectionsorting. Calculating the Fibonacci sequence The Fibonacci sequence is defined by
การแปล กรุณารอสักครู่..
