| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Module 2 - Algorithms

Page history last edited by Dr. Ron Eaglin 7 years, 11 months ago

Module 2 - Algorithms

 

Summary

 

You are going to have to be able to understand algorithms and ways to implement them through functions and methods. This is covered extensively in Topic - Algorithms and Programming . You should go through this topic thoroughly and then return to complete exercises in the assignments section.

 

When complete take a look at the flash card set at https://quizlet.com/11138404/algorithm-analysis-flash-cards/ - you should be familiar with each card in the entire set at this point. If you are not go back and review those that you do not know. This is the common language of programming and you will be expected to know it.

 

Assignments

 

Assignment 1 - Using your JSFiddle account you are going to create a guessing game, only it will be the computer doing the guessing. Here is how it works - the computer will ask you for a number between 1 and 1000, it will check first to make sure your input is within the bounds.

 

Once you enter the number it will guess the number and do a comparison with the number you entered. It will output the results of the guess and continue to do this until it gets the correct answer. This is what the output of the program will look like (if I enter 329)

 

Input: 329

Output:

Guessed 500 - too high.

Guessed 250 - too low.

Guessed 375 - too high.

Guessed 313 - too low.

Guessed 344 - too high.

Guessed 329 - Got It! 

It took me 6 Tries.

 

You can probably figure out how my algorithm works, yours should use the same basic logic. You will want to create an algorithm that is efficient (lowest possible O).

 

Programming parameters:

 

1 - This will be coded in Javascript.

2 - You should create a dimensioned array of 1000 elements.

3 - You should fill in the elements from 1 to 1000 in order prior to implementing the search

 

 

Quizzes (see quiz submission instructions)

 

note: Quizzes may be repeated in modules for reinforcement.

 

Quiz - Complete Quiz at http://geeksquiz.com/algorithms/recursion/ 

 

Assignment Grading Criteria

 

The quiz is worth 2 points, the program must work successfully for remaining credit. If the program gives the output shown above for the guess shown above then you know it is working correctly.

 

 

 

 

Previous: Module 1 - Time Complexity

Next: Module 3 - Lists

 

Comments (0)

You don't have permission to comment on this page.