Quantcast
Channel: LabVIEW topics
Viewing all articles
Browse latest Browse all 66850

How to find the mode of an array of strings

$
0
0

Hey guys,

 

So I came across this little problem that I thought I could solve relatively easily, but it turned out quite messy.

I have this array of strings and I want to find the most frequent entry of that array. Let's say I have the following array.

apple

apple

kiwi

orange

apple

 

the mode would give me apple. I thought about converting the strings into a number and then find the mode as usual.

But if the string was too long, it seems a single number cant be used to represent it.

Any ideas on a clean way to do this?


Viewing all articles
Browse latest Browse all 66850

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>