Computer Science Paper 1 - Fundamentals of algorithms

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Advantages of binary search

-As long as the list is sorted, binary search is more time efficient

Describe 2 advantages of representing algorithms using flowcharts?

-Flowcharts are standardised, therefore programmers can all agree on the symbols and their meanings -Flowcharts are very visual

Disadvantages and comparison of binary search

-More complex and more difficult to understand -Requires the input data to be sorted in order to work

ADVANTAGES of merge sort

-More time efficient -Consistent running time regardless of how ordered the items in the original list are.

Explain how the merge sort algorithm works (SORT ALGORITHM)

1. DIVIDE data in unsorted list into halves 2.CONQUER: solve each piece by applying divide-and -conquer to them repeatedly to them 3.COMBINE the two sorted sub-sequences into a single sorted list

Explain how the bubble sort algorithm works (SORT ALGORITHM)

1.Each item in a list is compared to the one next to it 2.If it is greater, they swap places 3.At the end of one round, the largest item is at the end of the list 4.Repeated until all items are sorted (works by iteration)

Explain how the linear search algorithm works (SEARCH ALGORITHM)

A linear search moves sequentially through your collection (or data structure) looking for a matching value

What is an algorithm?

A sequence of steps that can be followed to complete a task.

Describe PROCESSING in the IPO model

All the tasks needed to affect the transformation of inputs

What is decomposition?

Breaking a complex problem down into smaller problems and solving each one individually

Describe OUTPUT in the IPO model

Data and information flow out of the transformation process

How can an algorithm be more efficient that another?

It takes less time (time efficiency) to solve the same problem

Describe INPUT in the IPO model

The flow of data into the process from outside the system

Explain how the binary search algorithm works (SEARCH ALGORITHM)

The middle item is found in an ordered list If this term matches the target value, the binary search is complete If not, compare target value to the item in the middle of the array If the target value comes before the middle item, get rid of the second half of the list If the target value comes after the middle item get rid of the first half of the list Continue halving the list until the target value is matched

What is abstrarction?

The process of removing unnecessary detail from a problem to reduce it to something simpler to understand.

How can algorithms be represented?

Using pseudo-code or flowcharts

How can you determine the purpose of simple algorithms?

use trace tables and visual inspection to determine how simple algorithms work and what their purpose is.

Disadvantages of linear search

- Inefficient; the key element could be the last element -Takes more time; the time it takes to search gets longer at the same rate the list gets longer

Contrast and comparison of linear and binary search

-Binary search requires the input data to be sorted; Linear search does not -Binary search requires ordering comparison; linear search only requires equality comparisons -Binary search requires random access to the data; linear search only requires sequential access

ADVANTAGES of bubble sort

-Does not use much memory as the data is sorted within the list -Simple algorithm that can easily be implemented on a computer -Efficient way to check if a list is already in order

Advantages and comparison of linear search

-Doesn't require the input data to be sorted. Binary search does -Simple. It is very easy to understand and implement +comparison reasons

DISADVANTAGES of bubble sort

-Not time efficient -Slow for a very large list of items

Describe 3 disadvantages of flowcharts

-Time consuming to draw out -Difficult to modify -Sometimes special software is needed for symbols

DISADVANTAGES of merge sort

-Uses more memory as copies of the lists are created as they split up (recursive programming uses up lots of memory) -Even if the list is already sorted, it still goes through the whole splitting and merging process, so bubble sort may be quicker in some cases.

What is the difference between a computer program and a n algorithm?

A computer program is an implementation of an algorithm an algorithm is not a computer program.

'Be able to identify where inputs, processing and outputs take place in an algorithm' What model is used for this ?

IPO model - Input Process Output Model

Describe STORAGE in the IPO model

Keeps data until it is needed

True or False: More than one algorithm can be used to solve the same problem.

TRUE

Describe FEEDBACK in the IPO model

When outputs are fed back as inputs to form a circuit loop


Kaugnay na mga set ng pag-aaral

Kingdom Classification of Biodiversity HL Biology Unit 5

View Set

Drugs Used to Treat Migraine Headaches

View Set

5.- Colorado Statutes, Rules, and Regulations Common to All Lines

View Set

Chapter 13: Exporting and Global Sourcing

View Set

Data Analysis for Managers Chapters 6-8

View Set

Sexual Assault Prevention Ongoing Education Quiz - Undergrad RVSM Refresher 2/4 (100%)

View Set