Computer Science Algorithm Analysis

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Why can't we just code the algorithm and run it to see how it works?

-Different computers have different architectures -Language translation differs -Programmers have different skill levels -Loads on multiuser systems may vary -Math is good

How many comparison does Binary Search make?

2 comparison at most (if the item matches the current location; if not, whether its less than or greater than the midpoint)

In a list of 15 Elements, what is the average case for binary search?

About log(2) N

What are the Best, Worst, & Average Cases on Linear Search?

Best: 1 item examined Worst: N items examined Average: About N/2 items examined

What is the point of Linear & Binary Analysis?

Binary search works well if we have ordered data in a direct access data structure

How big is the instance characteristics?

Greater than or at least 1

What is the size of the problem (n) called?

Instance Characteristics of the problem.

How many elements of an ordered list do we need to examine before a search stops?

It Depends

Definition of Algorithm Analysis

Mathematical study of the performance of program statements, in terms of the size of the problem being solved.

Does a BST perform as binary search does?

Only on a perfectly even tree, It is just as good to search as a binary search on an ordered array.

What does the list have to be before a Binary Search in the list?

The list HAS to be ordered. Won't work on in-ordered list

Are approximations for functions allowed?

They are ok!

Binary Function Examples

log_2(N)

Linear Function Examples

n (n/2) 3n + 5

In a list of 15 Elements, how many are worst case or almost worst case for binary search?

12/15

How many comparison does Linear Search make?

1 comparison per item examined. (if the item matches the current location)


Set pelajaran terkait

29 Quiz 11 - The Nursing Process - Documenting & Recording

View Set

AVID MC 200 Certification Exam Study Guide

View Set

Asepsis and Infection Control (Prep U Quiz)

View Set

World History Chapter 10 (Rise of Islam)

View Set

Health Psychology Module 1: Introduction to Health Psychology

View Set

CompTIA A+ Certification Practice Test 1 (Exam 220-1001)

View Set

EXCEL - Chapter 5, EXCEL Chapter 7, Excel Chapter 7, Excel Chapter 5

View Set

SOCI 275 Symbolic Interactionism

View Set