Giter Site home page Giter Site logo

programming-univbasics-4-finding-the-minimum-value-in-an-array-lab-chi01-seng-ft-091420's Introduction

Using Loops and Arrays to Find Data

Learning Goals

  • Work with arrays and loops to extract specific values
  • Use loops to compare values in an array

Introduction

In the last lab, you were tasked with finding the maximum value in an array. For this last lab on working with arrays, your task is to do the opposite - find the minimum value in an array. This time, it'll be entirely up to you to solve this using what you've learned and the test output as guidance.

Instructions

For this lab's tests, assume all arrays are sets of positive integers. The find_min_value method and required parameter are provided for you in lib/find_the_minimum.rb. Write the implementation for this method, using learn to track your progress.

Finding a Minimum Value

The find_min_value(array) takes in an array of integers. This method should return whichever integer in the array has the lowest value.

find_min_value([10,5,3,7,19,1,3,10])

We should expect to receive 1 in return.

Conclusion

Learning to master using a collection to answer a question is usually accomplished by looping through a collection data type (either an Array or Hash). You might notice some similar coding between this solution and the last two labs. That suggests that there might be an awesome way to DRY out this code (and you'll see it very soon!).

While coding these implementations might feel repetitive after a while, they are worthwhile to practice. They ensure that you can reason clearly about how to use collection data to answer questions and they're commonly used in interviews. From there, it is only a few small conceptual steps to highly complex algorithms.

Resources

programming-univbasics-4-finding-the-minimum-value-in-an-array-lab-chi01-seng-ft-091420's People

Contributors

maxwellbenton avatar sgharms avatar donnadieu avatar drakeltheryuujin avatar

Watchers

 avatar  avatar Victoria Thevenot avatar Bernard Mordan avatar Otha avatar raza jafri avatar  avatar Joe Cardarelli avatar The Learn Team avatar  avatar  avatar Ben Oren avatar Matt avatar Antoin avatar Alex Griffith avatar  avatar Amanda D'Avria avatar  avatar Ahmed avatar Nicole Kroese  avatar Dominique De León avatar  avatar Lisa Jiang avatar Vicki Aubin avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.