Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

robots_rock Group Title

I am trying to finish a set of problems give to me by my teacher. I am using C I need to know about Arrays and How to find the mode inside an array.

  • 2 years ago
  • 2 years ago

  • This Question is Open
  1. adhokshaj Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    what do you mean by "mode"??

    • 2 years ago
  2. agdgdgdgwngo Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    The mode is the most frequently occurring element. This problem seems simple enough at first glance, but then you realize that an efficient solution requires playing with different kinds of data structures :) A C example is here: http://rosettacode.org/wiki/Averages/Mode#C but it seems way too complicated for my tastes.

    • 2 years ago
  3. agdgdgdgwngo Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    A simple way to do it is to sort the thing and then search for the longest-recurring element.

    • 2 years ago
  4. agdgdgdgwngo Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    http://ideone.com/Fpzxc

    • 2 years ago
  5. adhokshaj Group Title
    Best Response
    You've already chosen the best response.
    Medals 3

    It can be done without sorting as well. Just create a hash table to store element as key, and total no. of repetitions as value. Traverse the source array, and upate the hash table for each element detected. After traversal, iterate through the hash table to find the key with maximum value.

    • 2 years ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.