Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Summary

Summary Algorithms and Data Structures Tutorial - Full Course for Beginners

Rating
-
Sold
-
Pages
5
Uploaded on
23-05-2023
Written in
2020/2021

In this course you will learn about algorithms and data structures, two of the fundamental topics in computer science. There are three main parts to this course: algorithms, data structures, and a deep dive into sorting and searching algorithms. By the end, you will understand what algorithms and data structures are, how they are measured and evaluated, and how they are used to solve problems.

Show more Read less
Institution
Course

Content preview

Algorithms and Data Structures
Tutorial
Algorithmic Thinking: Searching for a Value
In this exercise, we will explore different strategies for searching for a value and how it can be
applied in real-life situations such as building websites and apps.

Introduction

When faced with a problem, there is no one-size-fits-all solution. The goal is to identify the
solution that works best for the given problem. In the game we played, both John and
Brittany took turns to guess a number. When the number was easy, they both took the same
number of turns. However, when the number was larger, Brittany's strategy performed better.

Comparing Strategies

We played the game twice, and the results varied based on the number they were searching
for. When the number was three, both John and Brittany took the same number of turns.
However, when the number was ten, Brittany's strategy was better. It is essential to note that
the specific value they are searching for may not matter as much as where that value lies in
the range given.

Real-Life Application

When building websites and apps, searching for a value is a common task. For instance, when
searching for a friend on Facebook, the app has to search through over 2 billion records to
find the person you are looking for. The speed at which the app finds the person matters as it
affects the user experience. Therefore, companies like Facebook work on making search as
fast as possible using different strategies.

Search Algorithms

John's strategy, where he started at the beginning of the range and counted one number after
the other, is a type of search called linear search. It is a search algorithm that follows a
specific set of guidelines:

Start at the beginning of the list or range of values.
Compare the current value to the target value.
If the current value is the target value, you are done.
If the current value is not the target value, move on to the next value in the list and
repeat step 2.
If you reach the end of the list, the target value is not in the list.

, Brittany's strategy performed better as it followed a different algorithm. The point is that
there is no one algorithm that works for all problems. The algorithm should be specific to the
given problem. An algorithm must have a clear problem statement, and the goal is to follow
the same set of guidelines each time you face the problem.


What Makes an Algorithm?
An algorithm is a set of steps that solves a specific problem. To define an algorithm, we need
to have a clear idea of the problem we are trying to solve, how the input is defined, and what
the output looks like when the algorithm has done its job. Here are some guidelines to follow:

The problem statement must be clearly defined.
The steps in the algorithm must be in a specific order and be distinct.
The algorithm must produce a result and complete in a finite amount of time.

These guidelines help us define what an algorithm is and help us verify that the algorithm is
correct. Consistent results for the same set of values is how we know that the algorithm is
correct. Before rushing in and thinking about solutions, we want to work through the
guidelines first and break down the problem into smaller, clearly defined problems.


What Makes a Good Algorithm?
There is no one single way to measure whether an algorithm is the right solution because it is
all about context. However, there are two measures of efficiency when it comes to algorithms:
time and space complexity. Time complexity is a measure of how long it takes the algorithm to
run, while space complexity deals with the amount of memory taken up on the computer.
Good algorithms need to balance between these two measures to be useful.


Measuring Algorithm Performance
When evaluating an algorithm, one important metric to consider is its running time, which
refers to how long the algorithm takes to run for a given set of values. This allows us to define
time complexity. To illustrate this, let's look at John's performance playing a game in which he
guesses a target value from a set of values. We will focus on his performance in four rounds:

In round one, John had 10 values to choose from, and the target was 3. He took 3 turns to
guess the answer.
In round two, John had 10 values again, but the target was 10. He took 10 turns to guess
the answer.
In round three, John had 100 values to choose from, and the target was 5. He took 5 turns
to guess the answer.
In round four, John had 100 values, and the target was 100. He took 100 turns to guess
the answer.

To measure John's performance, we can plot the number of tries it took him to guess the
answer (the running time of the algorithm) against the number of values in the range. By

Written for

Course

Document information

Uploaded on
May 23, 2023
Number of pages
5
Written in
2020/2021
Type
SUMMARY

Subjects

$24.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
deepprajapati

Get to know the seller

Seller avatar
deepprajapati
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions